Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Date formatting

Reply
Thread Tools

Date formatting

 
 
Trev@Work
Guest
Posts: n/a
 
      07-30-2004
Is there a way to format a date to the current user's country settings?
The date I post from the Date() function (Mozilla/JavaScript) is
incomprehensible by the back-end application (ASP/VBScript).
 
Reply With Quote
 
 
 
 
Grant Wagner
Guest
Posts: n/a
 
      07-30-2004
"Trev@Work" wrote:

> Is there a way to format a date to the current user's country settings?
> The date I post from the Date() function (Mozilla/JavaScript) is
> incomprehensible by the back-end application (ASP/VBScript).


Use a date format both the client and the server are sure not to
misinterpret:

YYYYMMDD[HH[MM[SS]]]

--
Grant Wagner <(E-Mail Removed)>
comp.lang.javascript FAQ - http://jibbering.com/faq

 
Reply With Quote
 
 
 
 
Dr John Stockton
Guest
Posts: n/a
 
      07-30-2004
JRS: In article <410a3946$0$9461$(E-Mail Removed)>, dated
Fri, 30 Jul 2004 13:04:17, seen in news:comp.lang.javascript, Trev@Work
<no.email@please.?> posted :

>Is there a way to format a date to the current user's country settings?
>The date I post from the Date() function (Mozilla/JavaScript) is
>incomprehensible by the back-end application (ASP/VBScript).


Methods toString & toLocaleString may do it.

The settings accepted by the back end, if in some way national, do not
necessarily include all of those that the front-end users may have
selected.

There is known to be one American, for example, who uses YYYY-MM-DD;
there may be others who comply with FIPS, their Federal Standard.

If your back end can receive a time_t, then that might be the best to
use, since javascript holds date/time in that form - if D is the Date
Object, just send D.getTime() . The present value is a little under
1091232000.

Ideal standards include YYYYMMDDhhmmss & YYYY-MM-DDThh:mm:ss ;
YYYY/MM/DD hh:mm:ss might be acceptable.

Consider carefully the effects of your local offset from GMT or UTC.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP General 11 11-08-2003 11:24 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments