TimeStringConvert (String function): Difference between revisions
Jump to navigation
Jump to search
m (→Syntax terms) |
No edit summary |
||
(13 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:String:TimeStringConvert subtitle}} | {{Template:String:TimeStringConvert subtitle}} | ||
==Syntax== | ==Syntax== | ||
{{Template:String:TimeStringConvert syntax}} | {{Template:String:TimeStringConvert syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%outString</th><td>string</td></tr> | <tr><th>%outString</th> | ||
<td>This string is the method object, <var class="term">string</var>, converted to the format in <var class="term">outputFormat</var>.</td></tr> | |||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>string</td></tr> | <td>A [[Datetime string formats|datetime]] string.</td></tr> | ||
<tr><th>inputFormat</th> | <tr><th>inputFormat</th> | ||
<td>string</td></tr> | <td>The datetime format of the method object <var class="term">string</var>.</td></tr> | ||
<tr><th>outputFormat</th> | <tr><th>outputFormat</th> | ||
<td>string</td></tr> | <td>A string that specifies the datetime format to which the method object is to be converted.</td></tr> | ||
<tr><th><var>CentSpan</var></th> | <tr><th><var>CentSpan</var></th> | ||
<td> | <td>This [[Notation conventions for methods#Named parameters|name allowed]] parameter is the <var>[[Datetime string formats#CENTSPAN|CENTSPAN]]</var> value used, if the <var class="term">inputFormat</var> has a two-digit year. The default is specified by the <var class="camel">[[CENTSPAN parameter|CENTSPAN]]</var> system parameter. </td></tr> | ||
</table> | </table> | ||
==Examples== | ==Examples== | ||
<ol> | |||
<li>This statement converts a value in <code>YYYYMMDDHHMISSXXX</code> format to the <code>Month DAY, YYYY HH:MI:SS.XXX</code> format: | |||
<p class="code">printText {~='20110520173648965':timeStringConvert('YYYYMMDDHHMISSXXX', 'Month DAY, YYYY HH:MI:SS.XXX')} </p> | |||
The result is: | |||
<p class="output">'20110520173648965':timeStringConvert('YYYYMMDDHHMISSXXX', 'Month DAY, YYYY HH:MI:SS.XXX')=May 20, 2011 17:36:48.965 </p> | |||
<li>This statement converts a value in <code>MM/DD/YY</code> format to the <code>Month DAY, YYYY</code> format: | |||
<p class="code">printText {~='12/22/11':timeStringConvert('MM/DD/YY', 'Month DAY, YYYY', centspan=1910)} </p> | |||
The result is: | |||
<p class="output">'12/22/11':timeStringConvert('MM/DD/YY', 'Month DAY, YYYY', centspan=1910)=December 22, 1911 </p> | |||
</ol> | |||
==See also== | ==See also== | ||
<ul> | |||
<li>Related intrinsic methods (provide conversion from one form of date representation to another): | |||
<ul> | |||
<li><var>[[DaysToString (Float_function)|DaysToString]]</var> | |||
<li><var>[[MillisecondsToString (Float_function)|MillisecondsToString ]]</var> | |||
<li><var>[[SecondsToString (Float_function)|SecondsToString]]</var> | |||
<li><var>[[StringToDays (String_function)|StringToDays]]</var> | |||
<li><var>[[StringToMilliseconds (String_function)|StringToMilliseconds]]</var> | |||
<li><var>[[StringToSeconds (String_function)|StringToSeconds]]</var> | |||
</ul> | |||
<li>Related <var>System</var> methods: | |||
<ul> | |||
<li><var>[[CurrentTimeMilliseconds (System function)|CurrentTimeMilliseconds]]</var> | |||
<li><var>[[CurrentTimeSeconds (System function)|CurrentTimeSeconds]]</var> | |||
<li><var>[[CurrentTimeDays (System function)|CurrentTimeDays ]]</var> | |||
<li><var>[[CurrentTimeString (System function)|CurrentTimeString ]]</var> | |||
</ul> | |||
</ul> | |||
{{Template:String:TimeStringConvert footer}} | {{Template:String:TimeStringConvert footer}} |
Latest revision as of 22:34, 3 September 2015
Convert date/time string from one format to another (String class)
[Introduced in Sirius Mods 7.9]
Syntax
%outString = string:TimeStringConvert( inputFormat, outputFormat, - [[CentSpan=] number]) Throws InvalidDateString
Syntax terms
%outString | This string is the method object, string, converted to the format in outputFormat. |
---|---|
string | A datetime string. |
inputFormat | The datetime format of the method object string. |
outputFormat | A string that specifies the datetime format to which the method object is to be converted. |
CentSpan | This name allowed parameter is the CENTSPAN value used, if the inputFormat has a two-digit year. The default is specified by the CENTSPAN system parameter. |
Examples
- This statement converts a value in
YYYYMMDDHHMISSXXX
format to theMonth DAY, YYYY HH:MI:SS.XXX
format:printText {~='20110520173648965':timeStringConvert('YYYYMMDDHHMISSXXX', 'Month DAY, YYYY HH:MI:SS.XXX')}
The result is:
'20110520173648965':timeStringConvert('YYYYMMDDHHMISSXXX', 'Month DAY, YYYY HH:MI:SS.XXX')=May 20, 2011 17:36:48.965
- This statement converts a value in
MM/DD/YY
format to theMonth DAY, YYYY
format:printText {~='12/22/11':timeStringConvert('MM/DD/YY', 'Month DAY, YYYY', centspan=1910)}
The result is:
'12/22/11':timeStringConvert('MM/DD/YY', 'Month DAY, YYYY', centspan=1910)=December 22, 1911
See also
- Related intrinsic methods (provide conversion from one form of date representation to another):
- Related System methods: