Groups
Groups
Sign in
Groups
Groups
Datejs - A JavaScript Date Library
Conversations
About
Send feedback
Help
Most efficient way to find the beginning of next month?
203 views
Skip to first unread message
Tuxlar
unread,
Dec 13, 2010, 9:10:52 AM
12/13/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Datejs - A JavaScript Date Library
What I'm using currently is:
now.addMonths(1).set({ day:0 }).clearTime();
What could make this better?
geoffrey.mcgill
unread,
Dec 13, 2010, 11:52:04 AM
12/13/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Datejs - A JavaScript Date Library
Hi,
I believe it would be day:1.
Example
Date.today().next().month().set({ day : 1})
Hope this helps.
Tuxlar
unread,
Dec 13, 2010, 7:54:42 PM
12/13/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Datejs - A JavaScript Date Library
Ah yeah, I mean day:1. Does setting to the next month bring it to the
beginning of that month?
RobG
unread,
Dec 22, 2010, 6:19:03 AM
12/22/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Datejs - A JavaScript Date Library
var d = new Date();
d.setMonth(d.getMonth() + 1, 1);
d.setHours(0,0,0);
--
Rob
Diana chow
unread,
Mar 2, 2011, 2:24:14 PM
3/2/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dat...@googlegroups.com
I find this to be pretty clear:
Date.parse('next month').moveToFirstDayOfMonth();
Reply all
Reply to author
Forward
0 new messages