Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am new to javascript. In javaScript i have to check the particular string is valid date or not. So i use Date.Parse("S.01.01.01"). But it was return the following answer (978287400000) instead of "S.01.01.01". How to solve this?

Regards,
Pavithra K.

What I have tried:

I tried to create obeject like below.

var d = new Date("S.01.01.01")

But it returns (Mon Jan 01 2001 00:00:00 GMT+0530 (India Standard Time)) instead of invalid date.
Posted
Comments
Karthik_Mahalingam 12-Jul-16 0:23am    
its a valid date only..
example: if you execute like this
new Date("S.51.051.051")
it will return as Invalid Date
Member 12545136 12-Jul-16 1:09am    
I want to maintain new Date("S.01.01.01") as "S.01.01.01". Is there any way to do this.

thanx,
Pavi
Prava-MFS 12-Jul-16 10:22am    
I don't think it is possible to get so. Either it will return INVALID DATE, if the date can not parse it, or it will return timestamp data if it can parse it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900