[Plugin] System date and time

  • Hi

    When I try to get the todays date using Rex's Date Time plugin I do not get the correct date!?

    E.g. today it is the 28. feb. 2015 (Windows clock report "28-02-2015" in lower right corner in my Task bar) , but 'Day-Month-Year' is returned like this '6-2-2105' !?

    This is my code:

    RexDate.Day & "-" & RexDate.Month & "-" & RexDate.Year

    and it return 6-2-1015

    What is going on here?! Does the plugin really not calculate the date correct (at least not here in Denmark (Europe)?

  • Problem solved!

    I changed my code to:

    RexDate.Date & "-" & RexDate.Month & "-" & RexDate.Year

    and now it works.

    Day is returning day number (0...6)

    Date is returning day of month (1..31)

  • rexrainbow

    hi, like your plugin but i have small problem.

    I would like to use it to determine wich loaded object is newest/oldest by complete date... year, month, day, min, sec, mili...

    but i have problem becouse i miss zero prefix in one digit months, days etc or double zeros in mili count.

    any tips how to sort this?

    thanx!!!

  • irina

    Compare timestamp by Expression:UnixTimestamp. Older would have small timestamp.

  • rexrainbow

    uh i dont get that unix timestamp.... how to pinpoint exact time?

    eg.

    when user opens the app i take a time stamp and i would like to set session time to expire at midnight every day (23:59)

    so that all downloaded data is valid for that day till 23:59 and when session is expired to reload all data (or next time the app is open)

    problem i have is when app is not opened for days...

  • and one more small problem...

    if user manipulates time on his sistem that affects my calculations...

    is there a way to retrieve correct time/date from some world clock URL?

  • irina

    This plugin only read timestamp at local machine.

    "World clock" is another issue, it might need a service/server.

  • Does it work on mobile? CocoonJS for example?

  • xanxion

    It works on cocoonJS and browser.

  • Lovely! thanks Rex!

  • Update

    Add time away L plugin which get elapsed interval of turned off game from local storage.

  • Does this work with cordova (crosswalk and phonegap) too?

  • rexrainbow what i should do to create condition if time elapsed is more than 3600 (one hour)

    on start of layout do something ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey delgado old friend, still having troubles with "System date" plugin?

    First you need to save current time somewhere in your events. Webstorage was usually very good at it.

    In your event's (when you want to save time) make event - > "Webstorage: Set local key "OldTime" to Data.UnixTimestamp

    Then on start of the layout you need to compare that to check if one hour have passed.

    on start of layout -> 3600 < Date.UnixTimestamp - int(WebStorage.LocalValue("OldTime")) - > do your events

    It basically says "if 3600 is less then (current time - saved time) then one hour have passed".

  • vybr

    rex_Date plugin and rex_time_away (stored in webstorage) plugin does.

    But rex_time_awayL (stored in localstorage) had not been tested yet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)