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

18replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 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)

    Like
    • UweG
    • UweG
    • 1 yr ago
    • Reported - view

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

    Like
    • UweG
    • UweG
    • 1 yr ago
    • Reported - view

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

    Like
    • joerstad
    • joerstad
    • 1 yr 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.

    Like
    • joerstad
    • joerstad
    • 1 yr 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.

    Like
    • UweG
    • UweG
    • 1 yr 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.

    Like
  • 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))))

    Like
    • joerstad
    • joerstad
    • 1 yr 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. 

    Like
    • joerstad
    • joerstad
    • 1 yr ago
    • Reported - view
    Like
    • joerstad
    • joerstad
    • 1 yr 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

    Like
    • UweG
    • UweG
    • 1 yr 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.

    Like
    • joerstad
    • joerstad
    • 1 yr 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 :-/

    Like
    • UweG
    • UweG
    • 1 yr ago
    • Reported - view

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

    Like
    • joerstad
    • joerstad
    • 1 yr ago
    • Reported - view

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

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

    Like
    • joerstad
    • joerstad
    • 1 yr ago
    • Reported - view

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

    Like
    • UweG
    • UweG
    • 1 yr ago
    • Reported - view

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

    Like
    • joerstad
    • joerstad
    • 1 yr ago
    • Reported - view

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

    Like
Like Follow
  • 1 yr agoLast active
  • 18Replies
  • 1508Views