JRS: In article <42**************@nospam.noaa.gov>, dated Wed, 30 Mar
2005 07:31:12, seen in news:comp.lang.javascript, RC
<ra**********@nospam.noaa.gov> posted :
Hahaha....!
I am try to do something like
2005-02-28 23:45:00 + 30 = 2005-03-01 00:15:00
I need to take care the leap year for February 28 days or 29 days,
the months for 30 days or 31 days.
I can do this in XSLT, but will very hassle and long.
Will be nice for me call Perl, or Java or JavaScript?
like
<xsl:value-of select="myjavascript:addTime('2005-02-28 23:45:00', 30)" />
You need to decide whether you want to do it in UTC or in local time.
Assuming from your -0500 that you are in East CONUS, it's likely that
you won't have to wait more than about 36 hours from now to see the
difference!
S = "2005-02-28 23:45:00" // or that plus " GMT"
S = S.replace(/-/g, "/") // AFAIK, all setups take yyyy/mm/dd
D = new Date(S)
D.setMinutes(D.getMinutes()+30) // or ...etUTCMin...
That will be correct for as long, ahead or aback, as the calendar rules
of the interpreting system are valid.
You'll also want, it seems, code to output D in ISO 8601, UTC or local;
for that, etc., see my Web site via sig below.
You should, of course, have known that from reading the newsgroup FAQ.
Now, after reading my relevant pages, can you explain US non-Fed
standards for week numbering?!? And US IRS practice?
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.