[Plugin] System date and time

Post your completed addons to share with the community

Post » Fri Jan 01, 2016 5:16 pm

@rexrainbow - are t0 and t1 in scale of days? How do I tell it with an expression to calculate the day,month and year of t1 and t0?

This is very confusing, can you post an example?
Do I convert t0 and t1 to a unix timestamp values, then calculate the difference and convert back to normal timestamp?
What is the expression to convert back to normal?
B
22
S
7
G
1
Posts: 270
Reputation: 2,674

Post » Sun Jan 03, 2016 12:24 am

@blurymind

No, t0 and t1 is milliseconds.
T = (t1 - t0)/1000 : seconds
T/60 : minutes
T/(60*60) : hours
T/(60*60*24) : days
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Sun Jan 03, 2016 9:39 am

And how do i get t0 and t1?
B
22
S
7
G
1
Posts: 270
Reputation: 2,674

Post » Mon Jan 04, 2016 12:21 am

@blurymind

Ony way to get t0, t1 is using Expression:UnixTimestamp to get current timestamp.
Or get specific timestamp by Expression:Date2UnixTimestamp(year, month, day)
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Tue Jan 05, 2016 12:17 am

Thank you, the formula worked! :)

Now on to figure out a user intuitive way to input the date. :lol:
B
22
S
7
G
1
Posts: 270
Reputation: 2,674

Post » Sat Jan 23, 2016 6:40 pm

Hi Rex,

I am using your plugin 'Date' and 'DateInARow'. Which plugin do you think will allow me to count the days that my game has been in use. For example, from day 1 of installing the game to the current date, something like you have been using this game for number of days. Its just for stats really. Is this at all possible. I have managed to get the date number and store that locally, then subtract if from the new date, but as soon as it goes into following month the calculation are out. Any ideas would be great.

Thanks John
B
5
Posts: 16
Reputation: 257

Post » Sun Jan 24, 2016 3:04 am

@johnhenderson196

Uses rex_date plugin ,and save (year, month, date).
Compare current date (year, month, date) with saved (year, month, date). If any of these 3 fields is different, then it is a new day now.
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Sun Jan 24, 2016 12:25 pm

Thanks for that Rex,

And for taking the time to respond. I have one query, that is, I can use the Browser plugin and store the date in a cookie, I presume as you have done in your capx examples. Or can I use the localstorage to save the date. Having read the manual it is possible for the user to remove all cookies on the device, thus removing the saved date. It sounds like local storage would be the securest option to use. I think unless any one else knows differently.

John
B
5
Posts: 16
Reputation: 257

Post » Sun Jan 24, 2016 3:00 pm

@johnhenderson196

I prefer saving data in webstorage/localstorage.
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Sun Jan 24, 2016 3:11 pm

Cool thanks Rex it makes much more sense
B
5
Posts: 16
Reputation: 257

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: andreyin, fernandochadu, iyenal222 and 4 guests