How do I convert a String like "11/21/2012" to Date in MongoDB?
I tried the following
obj.as_from = ISODate("11/21/2012");
and got this error
uncaught exception: invalid ISO date
Is there a simple way to convert the string above?
How do I convert a String like "11/21/2012" to Date in MongoDB?
I tried the following
obj.as_from = ISODate("11/21/2012");
and got this error
uncaught exception: invalid ISO date
Is there a simple way to convert the string above?
As pointed by user602525, in the Mongo shell.
obj.as_from = new Date("11/21/2012");
Do not forget to use the new
operator.