Namespace: OpenEdge.Core
Type: Class TimeStamp
Parent Classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object


Copyright (c) 2013, 2016, 2018, 2021-2022 by Progress Software Corporation. All rights reserved.
File:TimeStamp
Purpose:Primitive class for date, TimeStamp and TimeStamp-tz values
Author(s):pjudge
Created:Mon Nov 22 14:29:32 EST 2010
Notes:* Named 'TimeStamp' because of keyword/namespace conflicts with
ABL Primitive DATETIME. There's no built-in class for this.
/* (mandatory) The format of the data as passed into the constructor. One of DATE, DATETIME or DATETIME-TZ



Method Summary
  Options Name Purpose
  INTEGER CompareTo (TimeStamp) /* Comparison method, used by SortedSet's default comparer - If the returned value is less than 0 (zero), then the current object sorts before the object passed in. - If the returned value equals 0 (zero) , then the current object occupies the same position in the sort order. - If the returned value is greater than 0(zero), then the current object sorts after the object passed in. - If either object's Value is the unknown value (?), then that sorts high/early/before @param TimeStamp The object to compare to. @return integer 0 = same object +1 = sorts after -1 = sorts before */
  LOGICAL Equals (Object)
  INT64 MillisecondsSinceUnixEpoch () /* Returns the time interval in milliseconds between unix epoch and this date where unix epoch is an ABL date constructed as datetime(1,1,1970,0,0,0,0) @return int64 The number of milliseconds since the unix epoch */
  INT64 SecondsSinceUnixEpoch () /* Returns the time interval in seconds between unix epoch and this date where unix epoch is an ABL date constructed as datetime(1,1,1970,0,0,0,0) @return int64 The seconds since the unix epoch */
  DATE ToABLDateFromISO (character) /** Converts an ISO date into an ABL DATE. The ISO-DATE() requires the session's date format to be YMD before performing the conversion; this method wraps that. @param character An ISO date @return datetime-tz The date value to convert. */
  DATETIME ToABLDateTimeFromISO (character) /** Converts an ISO date into an ABL DATETIME. The ISO-DATE() requires the session's date format to be YMD before performing the conversion; this method wraps that. @param character An ISO date @return datetime The date value to convert. */
  DATETIME-TZ ToABLDateTimeTzFromHttp (character) /** Converts an HTTP 'sane date' into an ABL DATETIME-TZ. The HTTP date is defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 One of the following formats will be used: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format @param character An ISO date @return datetime-tz The date value to convert. */
  DATETIME-TZ ToABLDateTimeTzFromISO (character) /** Converts an ISO date into an ABL DATETIME-TZ. The ISO-DATE() requires the session's date format to be YMD before performing the conversion; this method wraps that. @param character An ISO date @return datetime-tz The date value to convert. */
  DATE ToDate () /* Converts the current TimeStamp to an ABL date value @return date The datetime-tz represented by this TimeStamp */
  DATETIME ToDateTime () /* Converts the current TimeStamp to an ABL datetime value @return datetime The datetime represented by this TimeStamp */
  DATETIME-TZ ToDateTimeTz () /* Converts the current TimeStamp to an ABL datetime-tz value @return datetime-tz The datetime-tz represented by this TimeStamp */
  CHARACTER ToHttpDate () /** Converts this TimeStamp into an HTTP 'sane date', according to RFC 822, as defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 One of the following formats will be used: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 @return datetime-tz The date value to convert. */
  CHARACTER ToHttpDateFromABL (datetime-tz) /** Converts an ABL date into an HTTP 'sane date', according to RFC 822, as defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 One of the following formats will be used: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 @param character An ISO date @return datetime-tz The date value to convert. */
  CHARACTER ToISODate () /** Converts an ABL datetime into a correct ISO date. @return character An ISO date. */
  CHARACTER ToISODateFromABL (date) /** Converts an ABL datetime into a correct ISO date. @param date The date value to convert @return character An ISO date. */
  CHARACTER ToISODateFromABL (datetime) /** Converts an ABL datetime into a correct ISO date. @param datetime The date value to convert @return character An ISO date. */
  CHARACTER ToISODateFromABL (datetime-tz) /** Converts an ABL datetime into a correct ISO date. @param datetime-tz The date value to convert @return character An ISO date. */
  INTEGER ToTime () /* Returns the current TimeStamp's time in milliseconds since midnight. @return integer The milliseconds represented by this TimeStamp */
  DATETIME-TZ TryParseTimestamp (character) /* Attempts to parse a string representing a timestamp into a DATETIME-TZ value Strings that can be parsed: YY/MM/DD@HH:MM:SS.SSS[timezone] in this case the century is assumed to be the current century CCYY/MM/DD@HH:MM:SS.SSS[timezone] CCYY-MM-DDTHH:MM:SS.SSS[timezone] Any single character can be used for date or time separators. Timezone values can be +NNNN -NNNN +NN:NN -NN:NN Z @param character The timestamp string @return datetime-tz A valid timestamp, or the unknown value if the string cannot be parsed. */

Constructor Summary
  Options Name Purpose
  TimeStamp () /* Default Constructor */
  TimeStamp (character) /* Constructor @param character An ISO-DATE representation of a timestamp */
  TimeStamp (date) /* Constructor @param date A timestamp. Timezone is inferred from the session */
  TimeStamp (datetime) /* Constructor @param datetime A timestamp. Timezone is inferred from the session */
  TimeStamp (datetime-tz) /* Constructor @param datetime-tz A 'complete' timestamp */

Property Summary
  Options Name Purpose
  CHARACTER Format


Method Detail
Top

INTEGER CompareTo (TimeStamp)

/* Comparison method, used by SortedSet's default comparer
- If the returned value is less than 0 (zero), then the current object sorts before the object passed in.
- If the returned value equals 0 (zero) , then the current object occupies the same position in the sort order.
- If the returned value is greater than 0(zero), then the current object sorts after the object passed in.
- If either object's Value is the unknown value (?), then that sorts high/early/before
+1 = sorts after
-1 = sorts before
Parameters:
pOther OpenEdge.Core.TimeStamp
 
Returns INTEGER
  integer 0 = same object
Top

LOGICAL Equals (Object)

Parameters:
p0 Progress.Lang.Object
 
Returns LOGICAL
 
Top

INT64 MillisecondsSinceUnixEpoch ()

/* Returns the time interval in milliseconds between unix epoch and this date
where unix epoch is an ABL date constructed as
datetime(1,1,1970,0,0,0,0)
Returns INT64
  int64 The number of milliseconds since the unix epoch
Top

INT64 SecondsSinceUnixEpoch ()

/* Returns the time interval in seconds between unix epoch and this date
where unix epoch is an ABL date constructed as
datetime(1,1,1970,0,0,0,0)
Returns INT64
  int64 The seconds since the unix epoch
Top

DATE ToABLDateFromISO (character)

Purpose: Converts an ISO date into an ABL DATE. The ISO-DATE()
requires the session's date format to be YMD before
performing the conversion; this method wraps that.
Parameters:
pcValue CHARACTER
 
Returns DATE
  datetime-tz The date value to convert.
Top

DATETIME ToABLDateTimeFromISO (character)

Purpose: Converts an ISO date into an ABL DATETIME. The ISO-DATE()
requires the session's date format to be YMD before
performing the conversion; this method wraps that.
Parameters:
pcValue CHARACTER
 
Returns DATETIME
  datetime The date value to convert.
Top

DATETIME-TZ ToABLDateTimeTzFromHttp (character)

Purpose: Converts an HTTP 'sane date' into an ABL DATETIME-TZ. The HTTP date is
defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
One of the following formats will be used:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
Parameters:
pcValue CHARACTER
 
Returns DATETIME-TZ
  datetime-tz The date value to convert.
Top

DATETIME-TZ ToABLDateTimeTzFromISO (character)

Purpose: Converts an ISO date into an ABL DATETIME-TZ. The ISO-DATE()
requires the session's date format to be YMD before
performing the conversion; this method wraps that.
Parameters:
pcValue CHARACTER
 
Returns DATETIME-TZ
  datetime-tz The date value to convert.
Top

DATE ToDate ()

/* Converts the current TimeStamp to an ABL date value
Returns DATE
  date The datetime-tz represented by this TimeStamp
Top

DATETIME ToDateTime ()

/* Converts the current TimeStamp to an ABL datetime value
Returns DATETIME
  datetime The datetime represented by this TimeStamp
Top

DATETIME-TZ ToDateTimeTz ()

/* Converts the current TimeStamp to an ABL datetime-tz value
Returns DATETIME-TZ
  datetime-tz The datetime-tz represented by this TimeStamp
Top

CHARACTER ToHttpDate ()

Purpose: Converts this TimeStamp into an HTTP 'sane date', according to RFC 822, as
defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
One of the following formats will be used:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Returns CHARACTER
  datetime-tz The date value to convert.
Top

CHARACTER ToHttpDateFromABL (datetime-tz)

Purpose: Converts an ABL date into an HTTP 'sane date', according to RFC 822, as
defined at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
One of the following formats will be used:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Parameters:
ptValue DATETIME-TZ
 
Returns CHARACTER
  datetime-tz The date value to convert.
Top

CHARACTER ToISODate ()

Purpose: Converts an ABL datetime into a correct ISO date.
Returns CHARACTER
  character An ISO date.
Top

CHARACTER ToISODateFromABL (date)

Purpose: Converts an ABL datetime into a correct ISO date.
Parameters:
ptValue DATE
 
Returns CHARACTER
  character An ISO date.
Top

CHARACTER ToISODateFromABL (datetime)

Purpose: Converts an ABL datetime into a correct ISO date.
Parameters:
ptValue DATETIME
 
Returns CHARACTER
  character An ISO date.
Top

CHARACTER ToISODateFromABL (datetime-tz)

Purpose: Converts an ABL datetime into a correct ISO date.
Parameters:
ptValue DATETIME-TZ
 
Returns CHARACTER
  character An ISO date.
Top

INTEGER ToTime ()

/* Returns the current TimeStamp's time in milliseconds since midnight.
Returns INTEGER
  integer The milliseconds represented by this TimeStamp
Top

DATETIME-TZ TryParseTimestamp (character)

/* Attempts to parse a string representing a timestamp into a DATETIME-TZ value
Strings that can be parsed:
YY/MM/DD@HH:MM:SS.SSS[timezone] MM:SS.SSS[timezone]
in this case the century is assumed to be the current century
CCYY/MM/DD@HH:MM:SS.SSS[timezone] MM:SS.SSS[timezone]
CCYY-MM-DDTHH:MM:SS.SSS[timezone] MM:SS.SSS[timezone]
Any single character can be used for date or time separators.
Timezone values can be
+NNNN
-NNNN
+NN:NN NN
-NN:NN NN
Z
Parameters:
pValue CHARACTER
 
Returns DATETIME-TZ
  datetime-tz A valid timestamp, or the unknown value if the string cannot be parsed.


Constructor Detail
Top

TimeStamp ()

/* Default Constructor
Top

TimeStamp (character)

/* Constructor
Parameters:
pcTimeStamp CHARACTER
 
Top

TimeStamp (date)

/* Constructor
Parameters:
ptTimeStamp DATE
 
Top

TimeStamp (datetime)

/* Constructor
Parameters:
ptTimeStamp DATETIME
 
Top

TimeStamp (datetime-tz)

/* Constructor
Parameters:
ptTimeStamp DATETIME-TZ
 


Property Detail
Top

CHARACTER Format

Returns CHARACTER