How do I convert a Date to a timestamp string?
my variable is:
d: Date = new Date();
how do I get a timestamp of that variable?
I'm using Angular2. Pleas help
How do I convert a Date to a timestamp string?
my variable is:
d: Date = new Date();
how do I get a timestamp of that variable?
I'm using Angular2. Pleas help
This more a javascript question than angular/typescript, but you can get a timestamp using
Date.now(); // return timestamp
You can read more here: How do you get a timestamp in JavaScript?
You can try
d: string = new Date().toLocaleString();
Or toISOString()
But you can find best solutions here
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString