Please enable JavaScript to view this site.

Codolex

This activity converts a datetime variable into a string or integer variable, depending on the method.

Uses System.DateUtils

 

DateTimeConversion

 

 

There are 5 options to convert to: Unix, ISO8601, JulianDate, ModifiedJulianDate, Milliseconds.

The 'Use UTC time' option is available on some conversions to indicate to the activity if the date provided is UTC, or the local time zone of the machine.

 

Unix

Returns an integer value of milliseconds between the given date and 1970-01-01 00:00:00 UTC.

 

Example:

Datetime value: 2024-01-01 00:00:00 - Use UTC time: true

begin

var ConvertedTime: Int64;

 ConvertedTime := DateTimeToUnix(Date, True);

end;

Result: 1704067200

 

ISO8601

Returns a string of the date formatted following ISO8601 standards.

 

Example

Datetime value: 2024-01-01 00:00:00 - Use UTC time: false - Time zone: UTC+1

begin

var ConvertedTime: string;

 ConvertedTime := DateToISO8601(Date, False);

end;

Result: 2025-01-01T00:00:00.000+01:00

 

JulianDate

The Julian date is the number of days, including fractional days, since 4713 BC January 1, Greenwich noon.

 

Example:

Datetime value: 2024-01-01 00:12:00

begin

var ConvertedTime: Double;

 ConvertedTime := DateTimeToJulianDate(Date);

end;

Result: 2.460.311,00

 

ModifiedJulianDate

The modified Julian date is the number of days, including fractional days, since Greenwich midnight on November 17, 1858. Modified Julian dates are based on Julian dates, but adjusted to use midnight rather than noon as a starting point. They use a more recent date as a starting point.

 

Example

Datetime value: 2024-01-01 00:12:00

begin

var ConvertedTime: Double;

 ConvertedTime := DateTimeToModifiedJulianDate(Date);

end;

Result: 60.310,50

 

Milliseconds

The amount of milliseconds between the given date and 00-00-00 00:00:00 UTC (0)

 

Example

Datetime value: 2024-01-01 00:00:00

begin

var ConvertedTime: Int64;

 ConvertedTime := DateTimeToMilliseconds(Date);

end;

Result: 63839750400000

 

© by GDK Software