question

anudeep avatar image
anudeep asked

How Can I get a timestamp and where should I be storing it?

I have checked the progressive rewards example on git hub and the cloudscript is js. I am currently working on Azure functions and want to know how I can get the time stamp and store it in player data.

Player DataCloudScriptCharacter Data
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

·
Xiao Zha avatar image
Xiao Zha answered

If by get the time stamp you mean get the current time, you can use DateTime.Now in your code to obtain the current time then call Update User Read Only Data API to store it in player data. In addition, since you want to store the time stamp in the player data, and the data in the player data has a LastUpdated property that records the times tamp of the last modification of that data, you can also use this time stamp in your code. You can call Get User Read Only Data API to obtain the timestamp.

2 comments
10 |1200

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

anudeep avatar image anudeep commented ·

The thing is in VS Code, I am not able to use most of the api. Is it possible for me to use all these api calls in azure function or is it something wrong from my side?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha anudeep commented ·

Yes, you can use all of these API calls in Azure Functions. Also, if you're building your game with Unity, calling the server API on the client requires enabling the server API in the PlayFab extension, but we don't recommend this because it exposes the Secret Key, which is not secure.

0 Likes 0 ·

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.