I called new Date(“Jan 4”)
and found the default year is 2001
a=new Date("Jan 4")
Thu Jan 04 2001 00:00:00 GMT-0500 (EST)
Is there any way that I can set the default year to be 2011?
update:
I know that I can use + 2011
but since I have some “Jan 4”, and some “Jan 4, 2008”
I only want to use 2011 for the former case.
However, I realize that if you do Date(“Jan 4, 2008 2011”) the year will be 2008 but not 2011. That’s just what I need.
I will mark the first answer correct anyway.
Can you try :
Update
You can split the string using