question

Chris B. avatar image
Chris B. asked

PlayFab timezone

I have a cloudscript that does this

var currDate = new Date();
    var dd = (currDate.getDate() < 10 ? '0' : '') + currDate.getDate();
    var mm = ((currDate.getMonth() + 1) < 10 ? '0' : '') + (currDate.getMonth() + 1);
    var yyyy = currDate.getFullYear();
    return (yyyy + "-" + mm + "-" + dd);

However, I seem to be getting the wrong Date. So I'm wondering if there is something I need to change to get the correct date back. While I know time zone differences will change when I get a date change, I'm feeling it's a bit off.

Example is I'm in a central time zone and it's 8:25pm on 6/4 however I'm getting 2016-06-05 back from this cloudscript call, which tells me this isn't returning a date from a US timezone (unless it rounds to the next date?)

I was hoping to have it sync with either pst timezone or cst timezone.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The PlayFab servers all report the current time in UTC. If you need to adjust it for a local player's timezone, the standard offsets would apply.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.