Weird date stuff...

J

John Kiernan

Hey JavaScript gurus!

Here's a weird one:

If I check (with an alert) this line:
vStrDate2 = vDate.toLocaleString();

I get: Saturday, August 14, 2004 7:57:30 PM (as I should)

but this operation...

vStrDate = vDate.getMonth() + "/" + vDate.getDate() + "/" + vDate.getYear();

Avails me: 7/14/2004 (!?!?!?!)

I check my computer date and it definitely believes (as do I) that it is
August. Any idea why getmonth() thinks it's July?

Also, is there an easier way to get this American date string?

TIA!

-- John Kiernan, KierPro Associates
Custom VFP/Accounting Programming
and Web interfaces
VFP and/or SQL back ends
 
J

John Kiernan

Okay, I figured out I should just do:

vStrDate = vDate()

(I'm new, bear with me), but....

It still thinks it's July!?!?! Anybody know why?

TIA, redux...

-- John Kiernan, KierPro Associates
Custom VFP/Accounting Programming
and Web interfaces
VFP and/or SQL back ends
 
L

Lee

John Kiernan said:
Hey JavaScript gurus!

Here's a weird one:

If I check (with an alert) this line:
vStrDate2 = vDate.toLocaleString();

I get: Saturday, August 14, 2004 7:57:30 PM (as I should)

but this operation...

vStrDate = vDate.getMonth() + "/" + vDate.getDate() + "/" + vDate.getYear();

Avails me: 7/14/2004 (!?!?!?!)

I check my computer date and it definitely believes (as do I) that it is
August. Any idea why getmonth() thinks it's July?

It doesn't think it's July. Month 7 is August. Month 0 is January.
That makes it much easier to use as an index into an array of month names.

See the FAQ and the references it contains for date manipulation.
http://www.jibbering.com/faq/
 
J

John Kiernan

See the FAQ and the references it contains for date manipulation.
I'd love to (and tried) but it's been down all day. Thanks for the answer
on the question though...

-- John Kiernan, KierPro Associates
Custom VFP/Accounting Programming
and Web interfaces
VFP and/or SQL back ends
 
M

Michael Winter

I'd love to (and tried) but it's been down all day. [...]

Yes, it has. However, the FAQ is posted three times a week. From the FAQ:

"The FAQ will currently be posted in two parts, one part (the
Quick Answers) on Mondays and Fridays, with the remainder posted
on wednesdays."

The post on Friday was made just before 1200 GMT.

[snip]

Mike
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sun,
15 Aug 2004 04:46:05, seen in John Kiernan
I'd love to (and tried) but it's been down all day. Thanks for the answer
on the question though...

-- John Kiernan, KierPro Associates
Custom VFP/Accounting Programming
and Web interfaces
VFP and/or SQL back ends

Responses should go after trimmed quotes. The correct signature
delimiter is a line containing only minus minus space . Agreed about
jibbering down-ness; perhaps there should be a mirror at a reliable ISP?
Garbo might be willing to take it, and Garbo is itself mirrored ...


For Web use, the Web being international, you should use 2004-08-14
19:57:30, and add a time zone indication. AIUI, YYYY-MM-DD is in FIPS.


You exaggerate. Adding 1, or using MNA = ['', 'Jan', 'Feb', ... is not
really difficult.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top