The opposite conversion is easy If you want to display a particular format. Delete all old emails after a certain date i have too many emails
How do i delete all those older than a certain date Dates don't have an inherent format I haven't tried anything because i can't keep selecting and deleting 10,000 old emails.
How do i get this? New date().gettime() functionally equivalent to new date().valueof() date.now() functionally equivalent to the 2 methods above as mentioned in the comments and mdn links, date.now() is not supported in internet explorer 8 So if ie 8 compatibility is a concern you should use new date().valueof() at the cost of slightly diminished code readability. Just giving a more up to date answer in case someone sees this old post
Adding utc=false when converting to datetime will remove the timezone component and keep only the date in a datetime64 [ns] data type. If the datatype is date(time), the format shown is dependant on your local settings