[Javascript] European Date Formatting?
Paul McGuire
pmcguire at cguk.co.uk
Mon Aug 9 07:06:59 CDT 2004
Thanks Guys,
I will let you know how I get on...
----- Original Message -----
From: "Shawn Milo" <ShawnMilo at runbox.com>
To: <javascript at LaTech.edu>
Sent: Monday, August 09, 2004 12:53 PM
Subject: Re: [Javascript] European Date Formatting?
At the top of your function:
usDate = euDate.replace(/^(\d+)\/(\d+)\/(\d+)$/, '$2/$1/$3');
Shawn
> Hi ALL,
>
> I need to work out the number of days between two dates. However if I pass
> 01/02/02 into the below script it insists on working out a difference
using
> the date 2nd Jan 02 but as far as I am concerned (and millions of others)
> the above date is infact 1st Feb 02. I have tried
laterdate.toLocaleString()
> but this does not seem to have any effect whatsoever. How am I meant to
> force JavaScript to accept European formatted dates?
>
> My Code:
>
> var difference = laterdate.getTime() - earlierdate.getTime();
>
> var daysDifference = Math.floor(difference/1000/60/60/24);
> difference -= daysDifference*1000*60*60*24
> var hoursDifference = Math.floor(difference/1000/60/60);
> difference -= hoursDifference*1000*60*60
> var minutesDifference = Math.floor(difference/1000/60);
> difference -= minutesDifference*1000*60
> var secondsDifference = Math.floor(difference/1000);
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list