contents   index   previous   next



Clib.strftime()

syntax:

Clib.strftime(str, formatString, timeObj)

where:

str - a variable to receive the formatted time string.

 

formatString - string that specifies the final format.

 

timeObj - time variable in the Time object format.

 

return:

string - a string that describes the date and/or time and stores it in the variable string.

 

description:

This method creates a string that describes the date and or time and stores it in the variable str. The parameter formatString describes what the string will look like, and timeObj is a time object as returned by Clib.localtime().

 

These following conversion characters are used with Clib.strftime() to indicate time and date output:

 

%a
abbreviated weekday name (Sun)

%A
full weekday name (Sunday)

%b
abbreviated month name (Dec)

%B
full month name (December)

%c
date and time (Dec 2 06:55:15 1979)

%d
twodigit day of the month (02)

%H
twodigit hour of the 24hour day (06)

%I
twodigit hour of the 12hour day (06)

%j
threedigit day of the year from 001 (335)

%m
twodigit month of the year from 01 (12)

%M
twodigit minute of the hour (55)

%p
AM or PM (AM)

%S
twodigit seconds of the minute (15)

%U
twodigit week of year, Sunday is first day of week (48)

%w
day of the week where Sunday is 0 (0)

%W
twodigit week of year, Monday is first day of week (47)

%x
the date (Dec 2 1979)

%X
the time (06:55:15)

%y
twodigit year of the century (79)

%Y
the year (1979)

%Z
name of the time zone, if known (EST)

%%
the per cent character (%)

example:

// displays the full day name and month name

// of the current day

Clib.strftime(TimeBuf, 

              "Today is: %A, the month is: %B",

              Clib.localtime(time()));

Clib.puts(TimeBuf);

 


Clib.time()