Strftime: Difference between revisions

From Zandronum Wiki
(Created page with "{{Template:ACSWarning}} {{devfeature|3.0|150831-1814}} str '''Strftime'''(int timestamp, str format['', int utc'']) __NOTOC__ == Usage == === Parameters === * ''timestamp'':...")
 
No edit summary
Tag: Source edit
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Template:ACSWarning}}
{{Template:ACSWarning}}
{{devfeature|3.0|150831-1814}}


str '''Strftime'''(int timestamp, str format['', int utc''])
str '''Strftime''' (int timestamp, str format['', int utc''])
__NOTOC__
 
== Usage ==
== Usage ==
=== Parameters ===
=== Parameters ===
Line 11: Line 10:


=== Return value ===
=== Return value ===
A human-readable string from the given timestamp, formatted using the format parameter.
A human-readable string from the given timestamp, formatted using the ''format'' parameter.


Note that due to ACS's limitations, timestamps are suspectible to the [http://en.wikipedia.org/wiki/Year_2038_problem year 2038 problem].
Note that due to ACS's limitations, timestamps are suspectible to the [[wikipedia:Year 2038 problem|year 2038 problem]].


== Example ==
== Examples ==
This prints something like <code>{{CURRENTMONTHNAME}} {{CURRENTDAY}} {{CURRENTYEAR}}</code> to the screen.
This prints something like <code>{{CURRENTMONTHNAME}} {{CURRENTDAY}} {{CURRENTYEAR}}</code> to the screen.


Line 25: Line 24:
</syntaxhighlight>
</syntaxhighlight>


== See Also ==
== See also ==
*[[SystemTime]]
* [[SystemTime]]
*[[GetTimeProperty]]
* [[GetTimeProperty]]
 
[[Category: ACS functions]]

Latest revision as of 01:08, 3 July 2022

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

str Strftime (int timestamp, str format[, int utc])

Usage

Parameters

  • timestamp: the timestamp to format (use SystemTime to get the current time])
  • format: a string describing how the string is formatted. It may contain any supported conversion specifiers, which are replaced as appropriate.
  • utc: If true, then the timestamp will be localized using the UTC timezone, local timezone otherwise.

Return value

A human-readable string from the given timestamp, formatted using the format parameter.

Note that due to ACS's limitations, timestamps are suspectible to the year 2038 problem.

Examples

This prints something like November 21 2024 to the screen.

Script 1 (void)
{
    Print (s: Strftime (SystemTime(), "%B %d %Y", true));
}

See also