convertTimeToUtc

convertTimeToUtc(localTimestamp: TimeStamp): TimeStamp;

The convertTimeToUtc method of the JadeTimeZone class converts a timestamp for the time zone of the receiver to a timestamp for the Coordinated Universal Time (UTC) time zone, accounting for daylight saving and any historical time zone information that is available.

The following example shows the use of the convertTimeToUtc method that finds out what time it is in Rome right now.

example_convertTimeToUtc();
vars
    utcTimeStamp: TimeStamp;
    romeTimeStamp: TimeStamp;
    romeTimeZone: JadeTimeZone;
begin
    utcTimeStamp := app.getUTCTime(); 
        // Get the current UTC time
     romeTimeZone := JadeTimeZone@createTimeZoneByName("Europe/Rome");
        // Create a JadeTimeZone for Rome
    romeTimeStamp := romeTimeZone.convertTimeFromUtc(utcTimeStamp);
    write "The time in Rome right now is " & romeTimeStamp.String;
epilog
    delete romeTimeZone;
end;

2020.0.01 and higher