1,544
edits
DrinkyBird (talk | contribs) (Created page with "{{Template:ACSWarning}} {{devfeature|3.0|150831-1814}} int '''GetTimeProperty''' (int timestamp, int which['', int utc'']) __NOTOC__ == Usage == === Parameters === * ''timest...") |
DrinkyBird (talk | contribs) (Correct <tt>TM_DAY</tt> range) Tag: Source edit |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:ACSWarning}} | {{Template:ACSWarning}} | ||
int '''GetTimeProperty''' (int timestamp, int which['', int utc'']) | int '''GetTimeProperty''' (int timestamp, int which['', int utc'']) | ||
Line 7: | Line 6: | ||
=== Parameters === | === Parameters === | ||
* ''timestamp'': The timestamp to localize. | * ''timestamp'': The timestamp to localize. | ||
* ''which'': Which attribute to return. | * ''which'': Which attribute to return; see the [[#Time properties]] table below. | ||
* ''utc'': If true, the timestamp will be localized using the UTC timezone, local timezone otherwise | * ''utc'': If true, the timestamp will be localized using the UTC timezone, local timezone otherwise. | ||
== Time properties == | === Time properties === | ||
{| | {| class="wikitable" | ||
!Property | !Property | ||
!Range | !Range | ||
Line 29: | Line 28: | ||
|- | |- | ||
|<tt>TM_DAY</tt> (3) | |<tt>TM_DAY</tt> (3) | ||
| [ | | [1, 31] | ||
| Days | | Days | ||
|- | |- | ||
Line 45: | Line 44: | ||
|} | |} | ||
== | === Return value === | ||
Localizes the given timestamp and returns an attribute of it. | Localizes the given timestamp and returns an attribute of it. | ||
Note that due to ACS's limitations, the timestamp is suspectible to the [ | Note that due to ACS's limitations, the timestamp is suspectible to the [[wikipedia:Year 2038 problem|year 2038 problem]]. | ||
== See | == Examples == | ||
*[[SystemTime]] | The following script checks if the game is being played on a Thursday the 20th. | ||
*[[Strftime]] | <syntaxhighlight lang="c" line="1"> | ||
script 1 OPEN | |||
{ | |||
if (GetTimeProperty(SystemTime(), TM_WEEKDAY) == 4 && GetTimeProperty(SystemTime(), TM_DAY) == 20) | |||
PrintBold(s:"Happy Thursday the 20th!"); | |||
} | |||
</syntaxhighlight> | |||
== See also == | |||
* [[SystemTime]] | |||
* [[Strftime]] | |||
[[Category:ACS functions]] |