Sign In Register

How can we help you today?

Start a new topic
Answered

Is it possible to tell how long a user has been registered for?

I know that the system will tell us if a user has been registered with the system previously or not, but is there any way (from client or server/script code) to tell how long a user's account has been registered?


For our analytics system we want to track how long a user has been active in a game - is this something that is possible to do out of the box?


Thanx in advance,

Mike W



Best Answer
Hey Mike,

I have a solution for you from one of our tech-people.

var createdDate = new Date(parseInt(Spark.getPlayer().getPlayerId().substring(0,8), 16)*1000);

This will get you the creation time as UTC datetime so you may have to parse that back for your own use.

-Sean

 


Hey Mike,

That is currently not available. However, that data is stored in the player collection, so i've submitted a feature request for it to be added to the SparkPlayer object. I'll let you know as soon as its ready.


-Sean

Answer
Hey Mike,

I have a solution for you from one of our tech-people.

var createdDate = new Date(parseInt(Spark.getPlayer().getPlayerId().substring(0,8), 16)*1000);

This will get you the creation time as UTC datetime so you may have to parse that back for your own use.

-Sean

 

Cool thanx. I'll see if I can figure out how to get this working. 


Cheers,

Mike W 

Hi Mike,


In our latest release we have added a call that lets you to get the date the player was created.

 

Spark.getPlayer().getCreationDate();

 

You can read more about it here. Hope this helps.


Thanks,

Liam

Login to post a comment