You can use new Date() to get the current date / time
var now = new Date();
You can then use this in your update document
{"time" : now}
Gabriel
H
Hamlet Archer
said
about 7 years ago
how does one insert a date into a meta collection?
i've tried on the NoSQL Explorer to insert the following:
{"date":new Date("2014-12-11T14:12:00Z")}
{"date":ISODate("2014-12-11T14:12:00Z")}
{"date":new ISODate("2014-12-11T14:12:00Z")}
and it always says "Error Parsing JSON".
Customer Support
said
about 7 years ago
Just wish to note that we have taken this conversation to the ticket system with Hamlet.
Thanks.
F
Felix Palabrica
said
over 6 years ago
Since no one answered this question and I have a feeling that someone will encounter this problem again, I'll post a working solution. Use the extended JSON of mongodb to specify the date data type.
Lam Kok Weng
Hi guys,
How do I go about inserting and updating a document's field with the current time? Something like: {time:now()}.
You can use new Date() to get the current date / time
var now = new Date();
You can then use this in your update document
{"time" : now}
Gabriel
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
You can use new Date() to get the current date / time
var now = new Date();
You can then use this in your update document
{"time" : now}
Gabriel
Hamlet Archer
how does one insert a date into a meta collection?
i've tried on the NoSQL Explorer to insert the following:
{"date":new Date("2014-12-11T14:12:00Z")}
{"date":ISODate("2014-12-11T14:12:00Z")}
{"date":new ISODate("2014-12-11T14:12:00Z")}
and it always says "Error Parsing JSON".
Customer Support
Just wish to note that we have taken this conversation to the ticket system with Hamlet.
Thanks.
Felix Palabrica
Since no one answered this question and I have a feeling that someone will encounter this problem again, I'll post a working solution. Use the extended JSON of mongodb to specify the date data type.
{ logtime : {"$date" : "2016-07-11T03:54:59Z"} }
2 people like this
-
Rules regarding tickets and forum posts.
-
Uploading and retrieving an image from Unity to GameSparks
-
Setting up a score based asynchronous challenge
-
Social Friends System
-
For complicated client/server stuff, the GamesparksTestUI is really useful
-
How To Login with the Official Google Play Plugin for Unity on Android
-
Export / import entire class of data
-
GameSparks GameObject Singleton (Unity)
-
Creating a player-list for searching and storing player info
See all 44 topics