Reputation: 1416
I'm able to get date in long format with time
new Date().getTime()
which return long with time
1626429691945
is it possible to return date in long without hour , minute ,seconds
Upvotes: 0
Views: 38
Reputation: 14800
No. It is not possible.
Because Date.prototype.getTime() returns a long
representing the number of milliseconds since the Epoch it necessarily represents a specific time.
If you want that long
value the closest approximation to what you want would be to get the millisecond time of midnight of the date you want.
Nodar Sanaia's answer is a great way to get that midnight time.
Upvotes: 1