[Plugin] System date and time

Post your completed addons to share with the community

Post » Fri Apr 19, 2013 5:30 pm

[QUOTE=labithiotis] 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][/QUOTE]

It's already inside the plugin.

Check those 2 functions:
Date2UnixTimestamp
UnixtTimestamp
B
11
S
3
G
1
Posts: 35
Reputation: 1,832

Post » Sat Apr 20, 2013 12:36 am

[QUOTE=Labithiotis]
Format unix timestamp to a formatted time like HH:MM
[/QUOTE]

Those function produces a unix time stamp, not what I was asking for. (i.e. 1363058603023)

I want some expressions to take that number (AN UNIXTIMESTAMP / 1363058603023 ) and convert it to HH:MM or indervidually to Hours, Mins, and seconds so I can display that stamp as a time in UI.

1363058603023 --> 14:23 / 2:23pm
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Sat Apr 20, 2013 4:10 am

@labithiotis

It might help you.rexrainbow2013-04-20 04:15:32
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Sat Apr 20, 2013 11:51 am

Oh, Data.Hours & Minutes can actually take an argument for time, it doesn't show that when I use the expression so I just assumed it used current time only.

Thanks
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Sat Apr 20, 2013 1:46 pm

@labithiotis
Sorry, I will try to add more description in these expression.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Wed May 01, 2013 4:52 pm

Update

- Support save/load system
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Thu Jun 20, 2013 7:55 pm

This plugin is phenomenal. So simple, yet it adds SO much to construct. You, sir, are a gentleman and a scholar.
B
13
S
3
G
2
Posts: 51
Reputation: 2,255

Post » Wed Jul 03, 2013 12:30 am

New to Construct2 so I am probaly doing somthing really obviouly wrong here

Also just trying to work with it:

"now" instance Var

I get nothing when I click button.

Anybody let me know what I'm doing wrong or not understanding.

thnx SquareMation2013-07-03 02:36:45
B
7
S
2
G
2
Posts: 34
Reputation: 1,682

Post » Wed Jul 03, 2013 8:19 am

@SquareMation

Test capx, it works fine.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Tue Jul 16, 2013 3:36 pm

Feature Requests:

- Add Week as time unit
- Add "Get current month NAME, ...."
- Add ability to add days, weeks, months, years to today's date.

I realize that it is possible to convert to milliseconds and then back to do the date calculations and to assign variables for the month names [and I'm doing this now :) ], but it would be easier on the user if these were already baked in.

And Thank You for this Great plugin, should be added to core functions!
B
6
S
1
Posts: 29
Reputation: 658

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: spongehammer and 6 guests