[Plugin] System date and time

Post your completed addons to share with the community

Post » Tue Dec 25, 2012 11:24 am

@Joannesalfa

U can using the Unixtimestamp.

U need to save the unixtimestamp as webstorage-localvalue.
Then compare that saved unixtimestamp with the current unixtimestamp.
U can do that by setting a "global variable" to the current unixtimestamp while substracting the webstorage-saved unixtimestamp.

Every tick: set global variable to date.getunixtimestamp-webstorage.localvalue("save unixtimestamp")


The key is to calculate the data "from" that global variable.
So u can calculate the weeks/days/hours/minutes/seconds.

The global variable is set as the "difference" between past time and present time.
If i am correct u can calculate the days by dividing that "difference" by 864.
That leaves u with a big number which u would need to set to "floor" or "int" to get only the number before the (.)

Maybe not everything i type here is spot on because im not at my pc right now, but u get the general idea.Savvy0012012-12-25 11:31:50
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Thu Dec 27, 2012 4:54 pm

Update: (please download plugin at first post)

Add expression:Date2UnixTimestamp(year, month, day, hours, minutes, seconds, milliseconds) to convert date into timestamp.

Add optional second parameter into expression:Year(timestamp), expression:Month(timestamp), expression:Date(timestamp), expression:Day(timestamp), expression:Hours(timestamp), expression:Minutes(timestamp), expression:Seconds(timestamp), expression:Milliseconds(timestamp) , to convert timestamp into date.

So that user could transfer timestamp from/to date.

Capx

@Savvy001

Here it is.rexrainbow2013-04-20 04:12:14
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Thu Dec 27, 2012 5:28 pm

@rexrainbow

Wow thats fast!
Thank u Rex, this is the feature that makes my universe app complete!
The scope of things we can do with this is BIG.
When im at home tonight im going to code the **** out of my pc ;-)

U sir, are a true gentelmen!
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Tue Feb 12, 2013 3:28 pm

The plugin download link is broken. Is there another link?
B
7
S
1
Posts: 7
Reputation: 839

Post » Tue Feb 12, 2013 4:26 pm

@RedDragon

Thanks, I had fixed the download link, now it is on my dropbox folder.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Fri Feb 22, 2013 3:53 pm

This may seem like a noobish question, but I'm wondering if this could be used or easily tweaked to get the certain effect I'm looking for. I want to be able to set an initial time and date (not the system time), and have it increment by the time expression so that it is affected by timescale, so any increase or decrease in timescale affects the date and time accordingly.

Is this doable with this plugin, or am I better off looking into trying my hand on developing it myself?
B
4
Posts: 1
Reputation: 302

Post » Sat Feb 23, 2013 3:49 am

@Tybot

This plugin could not fit your requirement, sorry.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Fri Apr 05, 2013 10:45 am

@rexrainbow: Your plugin seems to work with WP8 device. I got the text changed when I change the date. However, when the date change from 6th to 7th, the number resets to 0 and start increasing from there. So 8th will be 1, 9th will be 2. That's still fine for me since I only want to implement the daily reward system to my game, but still wondering what's going on :)
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Fri Apr 05, 2013 10:59 am

Same thing happens in Windows 8
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Fri Apr 19, 2013 2:33 pm

Can you add the ability to format unix timestamp to a formatted time like HH:MM, tried adding it myself but it didn't work.

[code]
// create a new javascript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds
var date = new Date(unix_timestamp*1000);
// hours part from the timestamp
var hours = date.getHours();
// minutes part from the timestamp
var minutes = date.getMinutes();
// seconds part from the timestamp
var seconds = date.getSeconds();

// will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes + ':' + seconds;
[/code]
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests