OT: PVT: [Javascript] European Date Formatting?

Flavio Gomes flavio at economisa.com.br
Mon Aug 9 07:23:00 CDT 2004


This message is PVT.


Yes, I saw a RegExp, that's the old'good Milo...
 heheheheheh   =]

Shawn Milo wrote:

>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