$Sir Date: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (link repair) |
||
(35 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Sir_Date}} | {{DISPLAYTITLE:$Sir_Date}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Get current datetime</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent of $Sir_Date is <var>[[CurrentTimeString (System function)|CurrentTimeString]]</var>.</p> | ||
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. | 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== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%odate</span> <span class="literal">= $Sir_Date(</span><span class="term">fmt</span><span class="literal">,</span> <span class="term">errctl</span><span class="literal">)</span> | ||
< | |||
< | |||
</p> | </p> | ||
===Syntax terms=== | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%odate</th> | |||
<td>Set to contain the current date and time, in the format specified by <var class="term">fmt</var>. | |||
</td></tr> | |||
<tr><th>fmt</th> | <tr><th>fmt</th> | ||
<td> | <td>Optional datetime format string, defaults to <var>YY-MM-DD</var>. Refer to [[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> | <td>Optional error control string; refer to [[Datetime string formats#Datetime error handling|Datetime error handling]].</td></tr> | ||
</td></tr> | |||
</table> | </table> | ||
For | ==Usage notes== | ||
<ul> | |||
<li><var>$Sir_Date</var> 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"> | <p class="code">Print $Sir_Date('Wkday, DAY Month YYYY' WITH ' "A"T HH:MI:SS AM') | ||
</p> | </p> | ||
==Products authorizing {{PAGENAMEE}}== | |||
<ul> | <ul> | ||
<li>[[List of $functions|Sirius functions]]</li> | |||
<li>[[Sirius functions]]</li> | |||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
<li>[[Sir2000 User Language Tools]] | |||
<li> | |||
</ul> | </ul> | ||
[[Category:$Functions|$Sir_Date]] | [[Category:$Functions|$Sir_Date]] |
Latest revision as of 22:47, 8 February 2018
Get current datetime
Note: Many $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
%odate = $Sir_Date(fmt, errctl)
Syntax terms
%odate | Set to contain the current date and time, in the format specified by fmt. |
---|---|
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. |
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')