EasyLanguage Object Reference

DateTime Class

Defines the structure for an object that provides information about the system date and time.  

Namespace: elsystem

[ Expand All ]
Properties
  Name Type Description
Public property CurrentTime object Gets current time of day only.
Public property Day integer Gets and sets the day portion of the object's date.
Public property ELDate integer Gets and sets the date in legacy EasyLanguage format (YYYMMDD, where YYY is years since 1900, MM is the month, and DD is the day of the month).
Public property ELDateTimeEx double Gets and sets the date and time in legacy EasyLanguage format.
Public property ELTime integer Gets and sets the time in legacy EasyLanguage format (HHMM, where HH is the hours since midnight and MM is the minutes within the hour).
Public property Hour integer Gets and sets the hour portion of the time.
Public property Minute integer Gets and sets the minute portion of the object's time.
Public property Month integer Gets and sets the month portion of the object's date.
Public property Now object Gets the current date and time of object's day.
Public property Second integer Gets and sets the seconds portion of the object's time.
Public property Today object Gets the current date only.
Public property Value string Gets and sets the current date and time as a string.  Equivalent to ToString() when getting a date/time and Parse() when setting a date/time.
Public property Year integer Gets and sets the year portion of the object's date.
Methods
  Name Description
Public property Create Initializes an instance of the DateTime class.
Public property Create(y,m,d,h,m,s) Initializes an instance of DateTime with the specified year, month, day, hour, minute, and seconds parameters.
Public property Create(y,m,d) Initializes an instance of DateTime with the specified year, month, and day.
Public property ELFormatDate(format) Converts the DateTime value to a string using EL format codes "ddd MMM dd yy" (see FormatDate reserved word).
Public property ELFormatTime(format) Converts the DateTime value to a string using EL format codes "hh:mm:ss tt" (see FormatTime reserved word).
Public property Equals(obj) True if Obj is equal to the current instance, otherwise False.
Public property Format(format) Converts the DateTime value to a string using % format codes (see below).
Public property FromELDateAndTime(ElDate,ELTime) Converts legacy EL date and EL time values to a DateTime equivalent.
Public property Parse(string) Converts the date and time string parameter to a DateTime equivalent.
Public property SetToCurrentTime() Sets the DateTime value to the current date and time.
Public property ToString() Converts the DateTime value to a string.
Public property TryParse(string,result) True if date and time string will convert successfully to the result DateTime.
Operators
  Name Description
Public property operator+ Adds a specified TimeSpan to a specified DateTime, yielding a new date and time.
Public property operator+= Adds a specified TimeSpan to the current DateTime instance, yielding a new date and time.
Public property operator- Subtracts a specified TimeSpan from a specified DateTime, yielding a new date and time.
Public property operator-= Subtracts a specified TimeSpan from the current DateTime instance, yielding a new date and time.
Public property operator< True when one specified DateTime is less than another specified DateTime.
Public property operator<= True when one specified DateTime is equal to or less than another specified DateTime.
Public property operator> True when one specified DateTime is greater than another specified DateTime.
Public property operator>= True when one specified DateTime is greater than or equal to another specified DateTime.
Format Codes (used with the Format method)

The argument of the Format method consists of string including formatting codes that are preceded by a percent sign (%). Characters that do not begin with % are copied unchanged to destination string.

For example, to plot a formatted date using the abbreviated weekday, name of month, date, and full year:

Plot1(elsystem.Datetime.Today.Format("%a %b %d, %Y"));        // Wed May 05, 2010

or to plot the 12-hour time with AM/PM indication:

Plot2(elsystem.Datetime.CurrentTime.Format("%I:%M:%S, %p"));  // 01:22:14 PM

or to plot a formatted date and time:

Plot3(elsystem.Datetime.Now.Format("%m-%d-%y  %H:%M"));       // 05-05-10  13:22

The formatting codes are listed below:

Code Description
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Date and time representation appropriate for locale
%d Day of month as decimal number (01 - 31)
%H Hour in 24-hour format (00 - 23)
%I Hour in 12-hour format (01 - 12)
%j Day of year as decimal number (001 - 366)
%m Month as decimal number (01 - 12)
%M Minute as decimal number (00 - 59)
%p

Current locale's A.M./P.M. indicator for 12-hour clock

%S Second as decimal number (00 - 59)
%U Week of year as decimal number, with Sunday as first day of week (00 - 53)
%w Weekday as decimal number (0 - 6; Sunday is 0)
%W Week of year as decimal number, with Monday as first day of week (00 - 53)
%x Date representation for current locale
%X Time representation for current locale
%y Year without century, as decimal number (00 - 99)
%Y Year with century, as decimal number
%z, %Z Either the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown
%% Percent sign
Inheritance Hierarchy

elsystem.Object

  elsystem.DateTime