|
Written by martcon
|
|
Tuesday, 10 August 2010 15:15 |
|
When parsing dates in JavaScript it should be noted that Date.Parse() doesn't recognise strings with dates in the form dd-mmm-yyyy. One workaround is to first replace the '-' in the string with a space as follows:
// Replace '-' with spaces. Note that /-/g ensures that ALL '-' in the string are replaced.
strToParse = strToParse.replace(/-/g,' ');
// Display the parsed date.
alert(Date.Parse(strToParse);
|
|
Last Updated ( Tuesday, 10 August 2010 15:22 )
|