RTIF

RTIF is a CAOS command for converting integer time (UNIX/POSIX Time used by the game engine) into formatted date and/or time strings. (Real TIme Format)

Usage
Syntax: RTIF unix_time(int) formatting(string)

This will output unix_time as a human-readable or parsable string, where formatting is a string literal. Formatting can contain other characters in addition to the formatting codes below. For example, the string: "This is week %U of %Y." is valid.

Formatting Codes
The formatting string is used to get useful information from the unix_time passed to RTIF. The escape character in the formatting string is the percent sign, %. %a  Day of week name (abbreviated) - Mon, Tue, Wed, etc %A  Day of week name - Monday, Tuesday, Wednesday, etc %b  Month name (abbreviated) - Jan, Feb, Mar, etc %B  Month name - January, February, March, etc %c  Locale-aware full date and time (short) - 7/16/2013 5:13:14 AM, 16/7/2013 5:13:14 AM, etc %#c Locale-aware full date and time (long) - Tuesday, July 16, 2013 5:13:14 AM, etc %d  Day of month number - 01, ... 31  %H   Hour in 24-hour format - 00, 01, ... 23  %I   Hour in 12-hour format - 01, ... 12  %j   Day of year number - 001, ... 366  %m   Month number - 01, ... 12  %M   Minute number - 00, 01, ... 59  %p   Locale-aware AM/PM indicator %S  Second number - 00, 01, ... 59  %U   Week of the year number, using Sunday as first day of week - 00, 01, ... 53  %w   Weekday number, using Sunday as first day of week - 0, 1, ... 6  %W   Week of the year number, using Monday as first day of week - 00, 01, ... 53  %x   Locale-aware date (short) - 7/16/2013, 16/7/2013, etc %#x Locale-aware date (long) - Tuesday, July 16, 2013 - etc %X  Locale-aware time - 5:13:14 AM, 5.13.14 %y  Year number without century - 00, 01, ... 99  %Y   Year number - 2000, 2001, ... 2013, etc %z  Time-zone name - Eastern Daylight Time, Western Europe Time, etc %Z  Time-zone name (abbreviated) - EDT, WET, etc %#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y Remove any leading zeros.

To escape the percent sign, use %%. For example: "%y%% of the 20th century." -> 13% of the 20th century.

Examples
Using OUTS, RTIF, and a string literal, format and print today's (RTIM) short date (%x) using the CAOS Command Line: OUTS RTIF RTIM "%x" -> 7/16/2013

Using a variable string and flow control (DOIF), make your object celebrate Embrace Your Geekness Day. SETS VA00 RTIF RTIM "%#m%d" DOIF VA00 EQ "113" TARG OWNR SEZZ "Happy Embrace Your Geekness Day!" ENDI