JRS: In article <
[email protected]
t>, dated Mon, 25 Jul 2005 11:43:11, seen in
middletree said:
Is there a script that will populate, with a click, a textbox with the
equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it
to be in this format:
7/25/2005 10:58:39 AM
The default assumption in this newsgroup is that script is for the
World-Wide Web : note the first two W characters in particular.
That's a damfool format for use internationally, since a very
substantial majority of countries use either YYYY MM DD or DD MM YYYY,
which each have the numeric fields in a logical order.
Therefore, for numeric dates, one should always use the unambiguous form
YYYY MM DD - it is believed that even Americans can understand it.
One should also, of course, use the 24-hour clock - same comment.
By the way, you are wrong in saying that VBS Now() returns that form; it
does not, it returns a value of variant CDate, which is a count of days
(probably in IEEE Double format) from 1899-12-30 00:00:00 local time.
One can do simple arithmetic - addition and subtraction - on that CDate
and it remains a CDate. It is the conversion from CDate to string that
imposes a character-based format on the data; that format is localised,
and it is not always safe to assume anything about the localisation.
For date formatting in javascript, see via sig below.