I have searched in SO and did not find my answer.
Here is my query , In javascript we generally generate time stamp like below
Date.now()
which outputs something like 1424592736769
But this value changes each time , since time is associated with it.
For example Suppose I generate timestamp today and store in database....after few days If I enter date in format like 2012, 01, 1
, I should be able to get the same time stamp.
What I tried
//got time stamp
var a = Date.now() / 1000000 | 0
var d = Date(a);
console.log(d);
// and now based on the var a , I can be generate the timestamp based on specifying dateformat I know its wrong , some one guide me please.
P.S : I do this operation because I wanted to store a data on particular date
as time stamp in database and modify those data later based on that particular date
via timestamp.
For example my db should look like this
DAY DATA
------------------
432324234 - 1000 rs //day1 data
767677657 - 2000 rs //day2 data
P.s : no one understood my question , To be more clear
I need to get todays date for example (feb 22 2015) as time stamp , After few days if I use Date(2015,01,22) , I must get the same time stamp generated on feb 22 2015