Jump to content

Formatting date in java script


leelakrishnamoturu

Recommended Posts

I got a problem while formatting date in java scriptThe scenario is i will enter start date and end date in a form and i need to validate these date and the validation rule is end date should be greater than start dateWhen i am trying in US locale it working fine,but when i am trying in Australia locale with specific values Start Date is 24/09/2010 End date is 01/11/2010The validation is failedI am using Date.parse()/Date.parse().UTC() function in javascript to convert those date into millisecond and then later checking them which is biggerCould you find the solution for it

Link to comment
Share on other sites

If you know how the data base formats the date, and the format is consistent for every item, then you can use built-in string functions to parse the date into the format JavaScript expects.
For example, use split() to create an array of the pieces and then reassemble it into a string that JavaScript will understand.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...