JRS: In article <E2z8d.335366$F g5.101771@attbi _s53>, dated Tue, 5 Oct
2004 15:26:28, seen in news:comp.lang. javascript, McKirahan
<Ne**@McKirahan .com> posted :
var now = new Date();
var ymd = now.getFullYear ();
ymd += ((now.getMonth( )+101)+"").subs tr(1,2);
ymd += ((now.getDate() +100)+"").subst r(1,2);
ymd += ((now.getHours( )+100)+"").subs tr(1,2);
ymd += ((now.getMinute s()+100)+"").su bstr(1,2);
ymd += ((now.getSecond s()+100)+"").su bstr(1,2);
That looks like a translation of some half-baked code found in a
VBScript newsgroup.
Each line implements a function here often called LZ.
Testing in MSIE4 :
In VBScript, adding 100 and decapitating is the fastest way I know.
In javascript, it is not; my usual way is 40% faster.
with (new Date())
S = ((((getFullYear ()*100 + getMonth()+1)*1 00 + getDate())*100 +
getHours())*100 + getMinutes())*1 00 + getSeconds()
does the same job rather more simply, if S is then used as a string by
concatenation.
However, the job that it does seems only loosely related to what the OP
asked for.
The WebCam continuously updates a file of fixed name, and it is that
name by which it will be fetched. Fabrizio wants to display when that
file was last modified. A search of the newsgroup FAQ for Last,
Modified, or both would have helped. But see sig line 3 below :
it leads to <URL:http://www.merlyn.demo n.co.uk/js-date2.htm#lM>. 2.
ISTM that Fabrizio need only display the lastModified information
discussed there; either the raw string or the string corrected to
international format.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.