0

Timestamp UTC/GMT - formatted in english

I“m working on a log tool and have an issue. Is there a simple way to get a UTC timestamp to a field? Normally when I use ”Date Time“ I get my local date and time. In my case that is not usefull at all. I have tried to use this formule (from another post here) to get UTC (the hard way): 

let response := http(”GET“, url(”http://api.timezonedb.com/v2.1/convert-time-zone?key=MyPrivateKey&format=json&from=Europe/Oslo&to=Europe/London&time=“ + format(”Local Date / Time“, ”X“)));
”Local Date / Time“ + number(response.result.offset) * 1000

This works but the result is published in norwegian, which is not usefull for people around the world. This timestamp (UTC) is also not on the print form, it”s an empty field. The “Local Date / Time” is on the form for printing, but is in my log it is not usefull to show.

Short: I need the UTC date and time and this result should be printable.

 

BTW! I use the MacOS App

18 replies

null
    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    I have used the following formula to get an UTC timestamp in the iOS App. I don“t know if it works in the Mac OS App. Since it is a timestamp value, it can be formatted to your liking.

    let td := number(today());
    now() - timeinterval(round(td / 86400000) * 86400000 - td)

    • UweG
    • 3 yrs ago
    • Reported - view

    With format(now(),“”) you get UTC-Time from now().

    • UweG
    • 3 yrs ago
    • Reported - view

    You get this info from Database 0001_Ninox-Reference in the german webinar 2020 Team in Register Formatcodes.

    • joerstad
    • 3 yrs ago
    • Reported - view

    Uwe, I tried this on a Date / Time field:

    format(UTC4 := time(now()), “”)

    It displayed local time (Norway) not UTC, where did I go wrong? 

    BTW! Where can I see the “Database 0001_Ninox-Reference in the german webinar 2020 Team in Register Formatcodes”. Didn“t find it under webinars.

    • joerstad
    • 3 yrs ago
    • Reported - view

    Alain thanks for your input :-) The script ran but gave me one hour ahead of my local time (I know it needs tweaking). We use summer and winter time, so the difference between local and UTC time will not be constant. The script I already use takes this into consideration, but the time given by the formula (UTC) is not in the print form. I only have an empty UTC field there.

    • UweG
    • 3 yrs ago
    • Reported - view

    Hello
    The “Date/Time”Field does not display UTC-Time. If you use a text field or funktion/calculating field it will work.
    textfield := format(now(),“”)
    Write to Ninox Support with your Ninox email address requesting to be included in the Team Webinar DE 2020.

    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    The idea was indeed to adapt to the current offset. Maybe the way it is supposed to work is not valid on the Mac version. You may try this alternative formula:

    let stamp := now();
    let offs := split(format(stamp, “Z”), “:”);
    stamp - timeinterval(time(number(item(offs, 0)), number(item(offs, 1))))

    • joerstad
    • 3 yrs ago
    • Reported - view

    Thanks a lot for the inputs

     

    These are the the results:

    1: Local Date /Time (this is printable)

    2: The script that collects UTC from the web (that I found here earlier and posted in the first post). Have not figured out how to print this result. It“s formatted in norwegian, have tried to edit the formatting but nothing has helped.

    3: Alains first script, I made an error earlier so this works :-) But same as the other one, norwegian, cannot print the result.

    4: Uwes script.Textfield; this shows norwegian time and UTC offset. This result is printable. Have not figured out how to just show UTC time and formatting like DD.MM.YYYY HH:mm

    BTW! I”m new to Ninox, trying to learn, reading the manual and watching tutorials. 

    • joerstad
    • 3 yrs ago
    • Reported - view
    • joerstad
    • 3 yrs ago
    • Reported - view

    Since the web doesn not accept my screenshot:

    1: 22 des. 2020, 22:51

    2: 22 des. 2020, 21:51

    3: 22 des. 2020, 21:51

    4: 2020-12-22T22:52:02+01:00

    • UweG
    • 3 yrs ago
    • Reported - view

    Hello
    If you display your Ninox Mailadress i invite you to the Webinar Team.
    There is also a database, called 331_UTC Zeit-Time, where you find scriptcode to display UTC-Time in lokal time without offset.

    • joerstad
    • 3 yrs ago
    • Reported - view

    Thanks for the help Uwe :-) You mean publish it here on the forum? I could not find any way to edit my profile for you (as a registered user) to see my email :-/

    • UweG
    • 3 yrs ago
    • Reported - view

    if you use the cloud version, you find your email on the ninox website when you logged in under “My Profile”

    • joerstad
    • 3 yrs ago
    • Reported - view

    I“m in - asked the support for help and they fixed it :-)

    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    Would you mind sharing the solution? Still eager to learn...

    • joerstad
    • 3 yrs ago
    • Reported - view

    Alain, I still not have a solution, I“m looking at the webinar

    • UweG
    • 3 yrs ago
    • Reported - view

    Database 331_UTC Zeit-Time is also in the english Webinar Team.

    • joerstad
    • 3 yrs ago
    • Reported - view

    Yes I saw that. Thanks for the help, Uwe :-)

Content aside

  • 3 yrs agoLast active
  • 18Replies
  • 1620Views