I have a montodube set and I am storing date and time with other data. The problem is that when I get the data, the date and time are in a strange format and I'm not sure how I can handle it with javascript or jQuery.
My schema:
var carSchema = mongoose.Schema ({carType: string, notes: string, created: {type: date, default: date.now} });
This is getting me into javascript object:
created: "2015-03-15T14: 01: 16.447Z"
How can I convert it to time and date?
Can anyone help? Here I am giving some snippets of code that will help you to achieve your requirement.
var created_date = new date (carcade. Cated); Var month = ['Jan', 'Fur', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Akt', 'Nov', 'This ']; Var year = created_data.getfulair (); Var month = months [created_date.getMonth ()]; Var date = created_date.getDate (); Var hour = created_data Guesthors (); Var min = created_date.getMinutes (); Var sec = created_date.getSeconds (); Var time = date + ',' + month + '+ year +' '+ + +:' + min + ':' + seconds; // The last date over time, you can use it according to your requirement or var timestamp = created_data.gate time (); // Get the time stamp, you can now change the date and time using the simple JavaScript function.
You can set timezone for this time () to reset NMM
var time = requirement ('time'); Created_date.setTimezone ("Australia / Sydney");
thanks
No comments:
Post a Comment