Difference between revisions of "Working With Date and Time Data in Recital"

From Recital Documentation Wiki
Jump to: navigation, search
(Working With Date and Time Data in Recital)
(Miscellaneous Date and Time Functions)
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 
==Working With Date and Time Data in Recital==
 
==Working With Date and Time Data in Recital==
===Date and Time Conversion Functions===
+
Certain [[:Category:Set Commands|set commands]] change the date format:
 +
* [[SET CENTURY|set century]] - enable or disable inclusion of the century
  
'''See Also'''
+
<pre>
 +
set century on | off
 +
</pre>
  
Certain [[:Category:Set Commands|set commands]] change the date format: [[SET CENTURY|set century]], [[SET DATE|set date]], [[SET EPOCH|set epoch]] and [[SET MARK|set mark]].
+
* [[SET DATE|set date]] - define the date format
  
'''Table of Contents'''
+
<pre>
 +
set date [to] american | ansi | british | dmy | french | german | iso | italian | japan | mdy | usa | ymd
 +
</pre>
  
 +
* [[SET EPOCH|set epoch]] - specify a one hundred-year epoch to allow for two digit years
 +
 +
<pre>
 +
set epoch to <start-year as numeric>
 +
</pre>
 +
 +
* [[SET MARK|set mark]] - specify the separator character in dates
 +
 +
<pre>
 +
set mark to [<separator as character>]
 +
</pre>
 +
 +
===Date and Time Conversion Functions===
 
* [[CTOD()|ctod()]] - perform character to date conversion
 
* [[CTOD()|ctod()]] - perform character to date conversion
 +
 +
<pre>
 +
date = ctod(string as character)
 +
</pre>
 +
 
* [[CTOT()|ctot()]] - perform character to datetime conversion
 
* [[CTOT()|ctot()]] - perform character to datetime conversion
* [[DATE()|date()]] - perform numeric year,month,day to date conversion
+
 
* [[DATETIME()|datetime()]] - perform numeric year,month,day to datetime conversion
+
<pre>
 +
datetime = ctot(string as character)
 +
</pre>
 +
 
 +
* [[DATE()|date()]] - perform numeric year, month , day to date conversion
 +
 
 +
<pre>
 +
date = date(year as numeric, month as numeric, day as numeric)
 +
</pre>
 +
 
 +
* [[DATETIME()|datetime()]] - perform numeric year, month, day to datetime conversion
 +
 
 +
<pre>
 +
datetime = datetime(year as numeric, month as numeric, day as numeric)
 +
</pre>
 +
 
 
* [[DAYS()|days()]] - perform numeric seconds to numeric whole days conversion
 
* [[DAYS()|days()]] - perform numeric seconds to numeric whole days conversion
 +
 +
<pre>
 +
numeric = days(seconds as numeric)
 +
</pre>
 +
 
* [[DMY()|dmy()]] - perform date to character (DMY) conversion
 
* [[DMY()|dmy()]] - perform date to character (DMY) conversion
 +
 +
<pre>
 +
string = dmy(date as date)
 +
</pre>
 +
 
* [[DTOC()|dtoc()]] - perform date to character conversion
 
* [[DTOC()|dtoc()]] - perform date to character conversion
 +
 +
<pre>
 +
string = dtoc(date as date)
 +
</pre>
 +
 
* [[DTOM()|dtom()]] - perform date to string (DD-Mmm-YYYY) conversion
 
* [[DTOM()|dtom()]] - perform date to string (DD-Mmm-YYYY) conversion
 +
 +
<pre>
 +
string = dtom(date as date)
 +
</pre>
 +
 
* [[DTOS()|dtos()]] - perform date to string conversion
 
* [[DTOS()|dtos()]] - perform date to string conversion
 +
 +
<pre>
 +
string = dtos(date as date)
 +
</pre>
 +
 
* [[MDY()|mdy()]] - perform date to character (MDY) conversion
 
* [[MDY()|mdy()]] - perform date to character (MDY) conversion
 +
 +
<pre>
 +
string = mdy(date as date)
 +
</pre>
 +
 
* [[MTOD()|mtod()]] - perform string (DD-Mmm-YYYY) to date conversion
 
* [[MTOD()|mtod()]] - perform string (DD-Mmm-YYYY) to date conversion
 +
 +
<pre>
 +
date = mtod(string as character)
 +
</pre>
 +
 
* [[STOD()|stod()]] - perform string to date conversion
 
* [[STOD()|stod()]] - perform string to date conversion
 +
 +
<pre>
 +
date = stod(string as character)
 +
</pre>
 +
 
* [[TSTRING()|tstring()]] - perform numeric seconds to time string conversion
 
* [[TSTRING()|tstring()]] - perform numeric seconds to time string conversion
 +
 +
<pre>
 +
string = tstring(seconds as numeric)
 +
</pre>
 +
 
* [[TTOC()|ttoc()]] - perform datetime to string conversion
 
* [[TTOC()|ttoc()]] - perform datetime to string conversion
 +
 +
<pre>
 +
string = ttoc(datetime as datetime)
 +
</pre>
 +
 
* [[TTOD()|ttod()]] - perform datetime to date conversion
 
* [[TTOD()|ttod()]] - perform datetime to date conversion
 +
 +
<pre>
 +
date = ttod(datetime as datetime)
 +
</pre>
  
 
===Miscellaneous Date and Time Functions===
 
===Miscellaneous Date and Time Functions===
 +
* [[AMPM()|ampm()]] - return 12-hour clock time as a character string followed by "am" or "pm"
  
'''See Also'''
+
<pre>
 +
character = ampm()
 +
</pre>
  
Certain [[:Category:Set Commands|set commands]] change the date format: [[SET CENTURY|set century]], [[SET DATE|set date]], [[SET EPOCH|set epoch]] and [[SET MARK|set mark]].
+
* [[CDOW()|cdow()]] - return the character day of week from a date or datetime
  
'''Table of Contents'''
+
<pre>
 +
character = cdow(date as date | datetime as datetime)
 +
</pre>
  
* [[AMPM()|ampm()]] - return 12-hour clock time as a character string followed by "am" or "pm"
 
* [[CDOW()|cdow()]] - return the character day of week from a date or datetime
 
 
* [[CMONTH()|cmonth()]] - return the character month from a date or datetime
 
* [[CMONTH()|cmonth()]] - return the character month from a date or datetime
 +
 +
<pre>
 +
character = cmonth(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[DATE()|date()]] - return the system date as a date
 
* [[DATE()|date()]] - return the system date as a date
 +
 +
<pre>
 +
date = date()
 +
</pre>
 +
 
* [[DATETIME()|datetime()]] - return the system date and time as a datetime
 
* [[DATETIME()|datetime()]] - return the system date and time as a datetime
 +
 +
<pre>
 +
datetime = datetime()
 +
</pre>
 +
 
* [[DAY()|day()]] - return the numeric day of the month from a date or datetime
 
* [[DAY()|day()]] - return the numeric day of the month from a date or datetime
 +
 +
<pre>
 +
numeric = day(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[DOW()|dow()]] - return the numeric day of the week from a date or datetime
 
* [[DOW()|dow()]] - return the numeric day of the week from a date or datetime
 +
 +
<pre>
 +
numeric = dow(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[ELAPTIME()|elaptime()]] - return time difference between two time strings as a time string
 
* [[ELAPTIME()|elaptime()]] - return time difference between two time strings as a time string
 +
 +
<pre>
 +
character = elaptime(start-time as character | end-time as character)
 +
</pre>
 +
 
* [[EPOCH()|epoch()]] - return the current [[SET EPOCH|set epoch]] setting
 
* [[EPOCH()|epoch()]] - return the current [[SET EPOCH|set epoch]] setting
 +
 +
<pre>
 +
numeric = epoch()
 +
</pre>
 +
 
* [[GOMONTH()|gomonth()]] - return a date a specified number of months before or after a date or datetime
 
* [[GOMONTH()|gomonth()]] - return a date a specified number of months before or after a date or datetime
 +
 +
<pre>
 +
date = gomonth(date as date, months as numeric)
 +
</pre>
 +
 
* [[HOUR()|hour()]] - return the numeric hours from a datetime
 
* [[HOUR()|hour()]] - return the numeric hours from a datetime
 +
 +
<pre>
 +
numeric = hour(datetime as datetime)
 +
</pre>
 +
 
* [[HOURS()|hours()]] - return the numeric hours from a time string
 
* [[HOURS()|hours()]] - return the numeric hours from a time string
 +
 +
<pre>
 +
numeric = hours(time as character)
 +
</pre>
 +
 
* [[MINUTE()|minute()]] - return the numeric minutes from a datetime
 
* [[MINUTE()|minute()]] - return the numeric minutes from a datetime
 +
 +
<pre>
 +
numeric = minute(datetime as datetime)
 +
</pre>
 +
 
* [[MINUTES()|minutes()]] - return the numeric minutes from a time string
 
* [[MINUTES()|minutes()]] - return the numeric minutes from a time string
 +
 +
<pre>
 +
numeric = minutes(time as character)
 +
</pre>
 +
 
* [[MONTH()|month()]] - return the numeric month from a date or datetime
 
* [[MONTH()|month()]] - return the numeric month from a date or datetime
 +
 +
<pre>
 +
numeric = month(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[QUARTER()|quarter()]] - return the numeric year quarter from a date or datetime
 
* [[QUARTER()|quarter()]] - return the numeric year quarter from a date or datetime
 +
 +
<pre>
 +
numeric = quarter(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[SEC()|sec()]] - return the numeric seconds from a datetime
 
* [[SEC()|sec()]] - return the numeric seconds from a datetime
 +
 +
<pre>
 +
numeric = sec(datetime as datetime)
 +
</pre>
 +
 
* [[SECONDS()|seconds()]] - return the numeric seconds from the current time or a time string
 
* [[SECONDS()|seconds()]] - return the numeric seconds from the current time or a time string
 +
 +
<pre>
 +
numeric = seconds([time as character])
 +
</pre>
 +
 
* [[SECS()|secs()]] - return the numeric seconds from a time string
 
* [[SECS()|secs()]] - return the numeric seconds from a time string
 +
 +
<pre>
 +
numeric = minutes(time as character)
 +
</pre>
 +
 
* [[TIME()|time()]] - return the system time as a time string
 
* [[TIME()|time()]] - return the system time as a time string
 +
 +
<pre>
 +
character = time([include-hundredths as numeric])
 +
</pre>
 +
 +
* [[TIMEOFDAY()|timeofday()]] - return the system date and time
 +
 +
<pre>
 +
character = timeofday([format as numeric])
 +
</pre>
 +
 
* [[TIMESTAMP()|timestamp()]] - return the system date and time
 
* [[TIMESTAMP()|timestamp()]] - return the system date and time
 +
 +
<pre>
 +
character = timestamp([format as numeric])
 +
</pre>
 +
 
* [[VALIDTIME()|validtime()]] - check the validity of a time string
 
* [[VALIDTIME()|validtime()]] - check the validity of a time string
 +
 +
<pre>
 +
logical = validtime(time as character)
 +
</pre>
 +
 
* [[WEEK()|week()]] - return the numeric week from a date or datetime
 
* [[WEEK()|week()]] - return the numeric week from a date or datetime
 +
 +
<pre>
 +
numeric = week(date as date | datetime as datetime)
 +
</pre>
 +
 
* [[YEAR()|year()]] - return the numeric year from a specified date or datetime
 
* [[YEAR()|year()]] - return the numeric year from a specified date or datetime
 +
 +
<pre>
 +
numeric = year(date as date | datetime as datetime)
 +
</pre>

Latest revision as of 17:39, 14 January 2010

Working With Date and Time Data in Recital

Certain set commands change the date format:

  • set century - enable or disable inclusion of the century
set century on | off
set date [to] american | ansi | british | dmy | french | german | iso | italian | japan | mdy | usa | ymd
  • set epoch - specify a one hundred-year epoch to allow for two digit years
set epoch to <start-year as numeric>
  • set mark - specify the separator character in dates
set mark to [<separator as character>]

Date and Time Conversion Functions

  • ctod() - perform character to date conversion
date = ctod(string as character)
  • ctot() - perform character to datetime conversion
datetime = ctot(string as character)
  • date() - perform numeric year, month , day to date conversion
date = date(year as numeric, month as numeric, day as numeric)
  • datetime() - perform numeric year, month, day to datetime conversion
datetime = datetime(year as numeric, month as numeric, day as numeric)
  • days() - perform numeric seconds to numeric whole days conversion
numeric = days(seconds as numeric)
  • dmy() - perform date to character (DMY) conversion
string = dmy(date as date)
  • dtoc() - perform date to character conversion
string = dtoc(date as date)
  • dtom() - perform date to string (DD-Mmm-YYYY) conversion
string = dtom(date as date)
  • dtos() - perform date to string conversion
string = dtos(date as date)
  • mdy() - perform date to character (MDY) conversion
string = mdy(date as date)
  • mtod() - perform string (DD-Mmm-YYYY) to date conversion
date = mtod(string as character)
  • stod() - perform string to date conversion
date = stod(string as character)
  • tstring() - perform numeric seconds to time string conversion
string = tstring(seconds as numeric)
  • ttoc() - perform datetime to string conversion
string = ttoc(datetime as datetime)
  • ttod() - perform datetime to date conversion
date = ttod(datetime as datetime)

Miscellaneous Date and Time Functions

  • ampm() - return 12-hour clock time as a character string followed by "am" or "pm"
character = ampm()
  • cdow() - return the character day of week from a date or datetime
character = cdow(date as date | datetime as datetime)
  • cmonth() - return the character month from a date or datetime
character = cmonth(date as date | datetime as datetime)
  • date() - return the system date as a date
date = date()
  • datetime() - return the system date and time as a datetime
datetime = datetime()
  • day() - return the numeric day of the month from a date or datetime
numeric = day(date as date | datetime as datetime)
  • dow() - return the numeric day of the week from a date or datetime
numeric = dow(date as date | datetime as datetime)
  • elaptime() - return time difference between two time strings as a time string
character = elaptime(start-time as character | end-time as character)
numeric = epoch()
  • gomonth() - return a date a specified number of months before or after a date or datetime
date = gomonth(date as date, months as numeric)
  • hour() - return the numeric hours from a datetime
numeric = hour(datetime as datetime)
  • hours() - return the numeric hours from a time string
numeric = hours(time as character)
  • minute() - return the numeric minutes from a datetime
numeric = minute(datetime as datetime)
  • minutes() - return the numeric minutes from a time string
numeric = minutes(time as character)
  • month() - return the numeric month from a date or datetime
numeric = month(date as date | datetime as datetime)
  • quarter() - return the numeric year quarter from a date or datetime
numeric = quarter(date as date | datetime as datetime)
  • sec() - return the numeric seconds from a datetime
numeric = sec(datetime as datetime)
  • seconds() - return the numeric seconds from the current time or a time string
numeric = seconds([time as character])
  • secs() - return the numeric seconds from a time string
numeric = minutes(time as character)
  • time() - return the system time as a time string
character = time([include-hundredths as numeric])
character = timeofday([format as numeric])
character = timestamp([format as numeric])
logical = validtime(time as character)
  • week() - return the numeric week from a date or datetime
numeric = week(date as date | datetime as datetime)
  • year() - return the numeric year from a specified date or datetime
numeric = year(date as date | datetime as datetime)