Forum BigDB Calling Scores - returning prior day scores | off by a day

Discussion and help relating to the PlayerIO database solution, BigDB.

Calling Scores - returning prior day scores | off by a day

Postby vinceas3 » July 21st, 2011, 10:23 pm

Code: Select all
var date = new Date(2011, 06, 21);

This will call 2011, July (even though july is 07, the months start at 0, not 1 in AS3), 21st day

So this is fine so far, and I am looking to get 2011 July 21.

When I call upon scores using that new Date, this is what I get from BigDB
Scores["gZTt-PKyp0eyeFsM9l6yaA"] = {
Date:Wed Jul 20 18:00:00 GMT-0600 2011
Score:223
Username:"simplett3"
} (Version:1)

The interesting thing is, it reads "Wed Jul 20" when I have no scores saved for July 20, only one, today, July 21 / Thursday.
I looked at that key in BigDB "gZTt-PKyp0eyeFsM9l6yaA" and it shows the following:

Date | 2011-07-21 00:00:00
Username | simplett3
Score | 223

Also a picture:
Image

So the score, and the user name, and even the BigDB key is beautiful but when I want to call it, it says its from Wed July 20 1800 hours. An entire day off (not to mention the time is off, but not worried as much about the time in this scenario)

Any idea what is going on here?

Thanks
vinceas3
 
Posts: 77
Joined: January 16th, 2011, 11:25 pm

Re: Calling Scores - returning prior day scores | off by a day

Postby Toby » July 21st, 2011, 11:27 pm

Judging by the fact that it's six hours off, and the first time says GMT-6, I'd say it's because of the timezone on the server :D
User avatar
Toby
 
Posts: 86
Joined: January 14th, 2010, 4:01 pm

Re: Calling Scores - returning prior day scores | off by a day

Postby vinceas3 » July 21st, 2011, 11:37 pm

Toby wrote:Judging by the fact that it's six hours off, and the first time says GMT-6, I'd say it's because of the timezone on the server :D


Interesting. I was hoping it would call exactly what it sees within the index. Thanks Toby! :D
vinceas3
 
Posts: 77
Joined: January 16th, 2011, 11:25 pm

Re: Calling Scores - returning prior day scores | off by a day

Postby Henrik » July 22nd, 2011, 6:49 pm

All dates in BigDB are presumed to be UTC, internally it's stored and handled as milliseconds since 1970-01-01 00:00:00 UTC, so if your Flash client uses local time, you're gonna get funny results.

There should be methods for creating UTC Date objects in AS3, I suggest you look into those.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Calling Scores - returning prior day scores | off by a day

Postby vinceas3 » July 22nd, 2011, 6:58 pm

Henrik wrote:All dates in BigDB are presumed to be UTC, internally it's stored and handled as milliseconds since 1970-01-01 00:00:00 UTC, so if your Flash client uses local time, you're gonna get funny results.

There should be methods for creating UTC Date objects in AS3, I suggest you look into those.


I will do that thanks Henrik.
vinceas3
 
Posts: 77
Joined: January 16th, 2011, 11:25 pm


Return to BigDB



cron