I am now using the default created_at feature given by nodejs and mongodb.
But the thing is the actual time i created is different from the value return from server when created.
{
"_id": "615dbc9580b0913c58e32f41",
"createdAt": "2021-10-06T15:11:17.740Z",
"note": "I discount because i am bored",
"services": [
null,
null
],
"items": [],
"total_amount": 12000
}
In the above example , The time i created is 2021-10-06 10:10pm
bit there is a big differnet from the return date time which is 2021-10-06T15:11:17.740Z
how can i change this behavior
CodePudding user response:
If you are in the America/Los_Angeles time zone (Pacific Daylight time in early October) your time 2021-10-06 22:10
is the same as 2021-10-06T15:10Z
-- the Z means UTC.
So, if your diagnosis of the time shift is correct there's a one minute, seventeen second skew between the clock you used to get the 10:10pm
time and the one that was used to generate the timestamp in your object.
Honestly, that seems unlikely. It's quite hard to rig a server these days without NTP time synchronization.