now as reference

14 views
Skip to first unread message

Fares Farhan

unread,
Oct 12, 2009, 2:26:10 AM10/12/09
to Datejs - A JavaScript Date Library
Hi,

I did my best to search examples how to set now() as reference, but by
far, I found none that is close to what I expect. What I want to
achieve is something like :

2 hours from now() or
2 days before [specified date]

How can I accomplish this?

Apologize if the question has been answered before, but I couldn't
find the answer around.

Thank you in advance for any replies.

geoffrey.mcgill

unread,
Oct 12, 2009, 4:05:29 PM10/12/09
to Datejs - A JavaScript Date Library
> 2 hours from now() or

alert(new Date().add(-2).hours())

> 2 days before [specified date]

var date = Date.today(); // or some other date.

alert(date.add(-2).days());

Please ensure you use the latest build from svn (http://www.datejs.com/
svn/).

Hope this helps.
Reply all
Reply to author
Forward
0 new messages