Converting date/time types to text

EGL uses a different process to convert each date/time type to text:
TIMESTAMP
EGL uses strLib.defaultTimestampFormat if the variable has a valid value. If that format is not valid, EGL throws a RuntimeException. If the format is an empty string, EGL uses a portion of the following default format, which is based on the mask that you used to define the TIMESTAMP variable: "yyyy-MM-dd HH:mm:ss.SSSSSS". Consider the following example:
  strLib.defaultTimestampFormat = "";
  myTimestamp TIMESTAMP("HHmmss")? = "123102";	
  writeStdOut(myTimestamp);
EGL uses only the "HH:mm:ss" portion of the default format, and displays "12:31:02" on the console.
TIME
EGL uses strLib.defaultTimeFormat if the variable has a valid value. If that format is not valid, EGL throws a RuntimeException. If the format is an empty string, the result is an empty string.
DATE
EGL uses strLib.defaultDateFormat if the variable has a valid value. If that format is not valid, EGL throws a RuntimeException. If the format is an empty string, the result is an empty string.
INTERVAL (months)
EGL uses the mask that you used to define the variable to determine the number of digits for each portion of the interval. The formatted string can include the following characters, in the specified order:
  • A sign (one character), if the value is negative
  • The number of years (using the number of places specified in the mask)
  • A hyphen (one character)
  • The number of months (using the number of places specified in the mask)
EGL omits the leading zeros for the first specified value. For example, if the variable stores both years and months, EGL omits the leading zeros in the years value but retains the leading zeros in the months value. If the variable stores only months, EGL omits the leading zeros in the months value.
If the variable does not store both years and months, EGL omits the missing field and the hyphen. Consider the following example:
  myInterval INTERVAL("yyyy") = 25;
  writeStdOut(myInterval);
The console displays "25".
INTERVAL (seconds)
EGL uses the mask that you used to define the variable to determine the number of digits for each portion of the interval. The formatted string can include the following characters, in the specified order:
  • A minus sign (one character), if the value is negative
  • The number of days (using the number of places specified in the mask)
  • A space (one character)
  • The number of hours (as specified in the mask)
  • A colon (one character)
  • The number of minutes (as specified in the mask)
  • A colon (one character)
  • The number of seconds (as specified in the mask)
  • A decimal point (one character)
  • The number of fractions of seconds (as specified in the mask)
EGL omits the leading zeros for the first specified value. For example, if the variable stores both days and hours, EGL omits the leading zeros in the days value but retains the leading zeros in the hours value. If the variable stores only hours and minutes, EGL omits the leading zeros in the hours value but retains them in the minutes value.
If the variable does not store a particular field, EGL skips the field and the separator character (space, colon, or decimal) that comes after it. Consider the following example:
  myInterval INTERVAL("dddddHHmm") = -5231301;
  writeStdOut(myInterval);
The console displays "-523 13:01".

Feedback