$Sir Date: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
Line 9: Line 9:
<p class="syntax"><section begin="syntax" /> %odate = $Sir_Date(fmt, errctl)
<p class="syntax"><section begin="syntax" /> %odate = $Sir_Date(fmt, errctl)
<section end="syntax" /></p>
<section end="syntax" /></p>
<p class="caption">$Sir_Date Function
</p>


where
===Syntax terms===


<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>fmt</th>
<tr><th>fmt</th>
<td>optional datetime format string, defaults to 'YY-MM-DD'. Refer to for an explanation of valid datetime formats and valid datetime values.</td></tr>
<td>Optional datetime format string, defaults to 'YY-MM-DD'. Refer to [[Datetime string formats|"Datetime string formats"]] for an explanation of valid datetime formats and valid datetime values.</td></tr>
<tr><th>errctl</th>
<tr><th>errctl</th>
<td>optional error control string, refer to .</td></tr>
<td>Optional error control string; refer to [[Datetime string formats#Datetime Error Handling|"Datetime Error Handling"]].</td></tr>
<tr><th>%odate</th>
<tr><th>%odate</th>
<td>set to contain the current date and time, in the format specified by '''fmt'''.
<td>Set to contain the current date and time, in the format specified by <var class="term">fmt</var>.
</td></tr>
</td></tr>
</table>
</table>


For example, the following fragment prints a value such as <tt>.Monday, 1 January 2001 AT 01:11:10 PM</tt>.
==Usage notes==
<ul>
<li>$Sir_Date returns the null string in the following error case: <var class="term">fmt</var> is not a valid datetime format.
For more information about error handling, see [[Datetime string formats#Datetime Error Handling|"Datetime Error Handling"]]).
</ul>
 
==Example==
The following fragment prints a value such as <code>Monday, 1 January 2001 AT 01:11:10 PM</code>:


<p class="code"> PRINT $Sir_Date('Wkday, DAY Month YYYY' WITH ' "A"T HH:MI:SS AM')
<p class="code">Print $Sir_Date('Wkday, DAY Month YYYY' WITH ' "A"T HH:MI:SS AM')
</p>
</p>


Error conditions are shown in the following figure (see the discussion in ).
<ul>
<li><i>fmt</i> is not a valid datetime format.
</ul>
<p class="caption"> $Sir_Date returns the null string in the following error cases:</p>


<ul class="smallAndTightList">
<ul class="smallAndTightList">

Revision as of 20:31, 8 February 2012

Get current datetime

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent of $Sir_Date is CurrentTimeString.

This function accepts an optional datetime format string and an optional error control string, and returns the current date and time as a character string with the specified format.

Syntax

<section begin="syntax" /> %odate = $Sir_Date(fmt, errctl) <section end="syntax" />

Syntax terms

fmt Optional datetime format string, defaults to 'YY-MM-DD'. Refer to "Datetime string formats" for an explanation of valid datetime formats and valid datetime values.
errctl Optional error control string; refer to "Datetime Error Handling".
%odate Set to contain the current date and time, in the format specified by fmt.

Usage notes

  • $Sir_Date returns the null string in the following error case: fmt is not a valid datetime format. For more information about error handling, see "Datetime Error Handling").

Example

The following fragment prints a value such as Monday, 1 January 2001 AT 01:11:10 PM:

Print $Sir_Date('Wkday, DAY Month YYYY' WITH ' "A"T HH:MI:SS AM')


Products authorizing $Sir_Date