admin管理员组文章数量:1026989
how in jQuery work date? I want to perform mathematical operations to date.
var date = '2010-11-23 21:32:31';
var date = date - 70;
alert(date);
how get: 2010-11-23 21:31:21
Thanks
how in jQuery work date? I want to perform mathematical operations to date.
var date = '2010-11-23 21:32:31';
var date = date - 70;
alert(date);
how get: 2010-11-23 21:31:21
Thanks
Share Improve this question edited Oct 25, 2010 at 19:11 jcolebrand 16k12 gold badges77 silver badges122 bronze badges asked Oct 25, 2010 at 19:03 lolalolalolalola 3,82120 gold badges64 silver badges98 bronze badges 3- There is no "jQuery" way to work with date objects. It's strictly javascript/ECMAscript. – jcolebrand Commented Oct 25, 2010 at 19:07
- Edited tags: leaving in jQuery since the original poster asked it. – jcolebrand Commented Oct 25, 2010 at 19:11
- 1 See related asked a couple hours ago: stackoverflow./questions/4016318/… – Roatin Marth Commented Oct 25, 2010 at 19:26
2 Answers
Reset to default 6Try:
http://www.datejs./
It's not jQuery, but will solve your problems.
From their sample page:
// What date is next thrusday?
Date.today().next().thursday();
// Add 3 days to Today
Date.today().add(3).days();
// Is today Friday?
Date.today().is().friday();
// Number fun
(3).days().ago();
// 6 months from now
var n = 6;
n.months().fromNow();
// Set to 8:30 AM on the 15th day of the month
Date.today().set({ day: 15, hour: 8, minute: 30 });
// Convert text into Date
Date.parse('today');
Date.parse('t + 5 d'); // today + 5 days
Date.parse('next thursday');
Date.parse('February 20th 1973');
Date.parse('Thu, 1 July 2004 22:30:00');
This is not really a jQuery question as it is more a javascript question. For that answer, have a look at this: http://www.w3schools./jsref/jsref_obj_date.asp.
how in jQuery work date? I want to perform mathematical operations to date.
var date = '2010-11-23 21:32:31';
var date = date - 70;
alert(date);
how get: 2010-11-23 21:31:21
Thanks
how in jQuery work date? I want to perform mathematical operations to date.
var date = '2010-11-23 21:32:31';
var date = date - 70;
alert(date);
how get: 2010-11-23 21:31:21
Thanks
Share Improve this question edited Oct 25, 2010 at 19:11 jcolebrand 16k12 gold badges77 silver badges122 bronze badges asked Oct 25, 2010 at 19:03 lolalolalolalola 3,82120 gold badges64 silver badges98 bronze badges 3- There is no "jQuery" way to work with date objects. It's strictly javascript/ECMAscript. – jcolebrand Commented Oct 25, 2010 at 19:07
- Edited tags: leaving in jQuery since the original poster asked it. – jcolebrand Commented Oct 25, 2010 at 19:11
- 1 See related asked a couple hours ago: stackoverflow./questions/4016318/… – Roatin Marth Commented Oct 25, 2010 at 19:26
2 Answers
Reset to default 6Try:
http://www.datejs./
It's not jQuery, but will solve your problems.
From their sample page:
// What date is next thrusday?
Date.today().next().thursday();
// Add 3 days to Today
Date.today().add(3).days();
// Is today Friday?
Date.today().is().friday();
// Number fun
(3).days().ago();
// 6 months from now
var n = 6;
n.months().fromNow();
// Set to 8:30 AM on the 15th day of the month
Date.today().set({ day: 15, hour: 8, minute: 30 });
// Convert text into Date
Date.parse('today');
Date.parse('t + 5 d'); // today + 5 days
Date.parse('next thursday');
Date.parse('February 20th 1973');
Date.parse('Thu, 1 July 2004 22:30:00');
This is not really a jQuery question as it is more a javascript question. For that answer, have a look at this: http://www.w3schools./jsref/jsref_obj_date.asp.
本文标签: JavaScriptJQuerywork with dateStack Overflow
版权声明:本文标题:javascript - jquery, work with date - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745132509a2136206.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论