-
Notifications
You must be signed in to change notification settings - Fork 1.4k
This post shows up still in 2019 🔢 #2483
Unanswered
bswatantra
asked this question in
Q&A
-
This post shows up still in 2019 🔢
use MongoDB\BSON\UTCDateTime;
new UTCDateTime(new \DateTime('now'));
Carbon extends DateTime so a carbon instance should be usable:
new UTCDateTime(Carbon::now());
Originally posted by @marcnewton in #594 (comment)
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
while fetching data I get
"created_at": {
"$date": {
"$numberLong": "1653035305018"
}
}
but I want it
2022年05月20日T08:28:25.021000Z
OR
022-05-20 14:13:27
Beta Was this translation helpful? Give feedback.
All reactions
1 reply
-
Hi @bswatantra,
I think this issue is not related to this repo. I suggest you to always save dates to database like this:
new UTCDateTime(new DateTime($mydate));
I think it is the only way to retrieve a correct instance of date.
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment