Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object Time Methods >
Clib.strftime() Method
This method creates a string that describes the date, the time, or both, and stores it in a variable. Syntax
Clib.strftime(stringVar, formatString, Time)
|
|
stringVar |
A variable to hold the string representation of the time |
formatString |
A string that describes how the value stored in stringVar is formatted, using the conversion characters listed in the Usage topic |
Time |
A time object as returned by Clib.localtime() |
Returns
A formatted string as described by formatString. Usage
For details on the Time object, see The Time Object. The conversion characters in the following table 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 |
Two-digit day of the month |
02 |
%H |
Two-digit hour of the 24-hour day |
06 |
%I |
Two-digit hour of the 12-hour day |
06 |
%j |
Three-digit day of the year from 001 |
335 |
%m |
Two-digit month of the year from 01 |
12 |
%M |
Two-digit minute of the hour |
55 |
%p |
AM or PM |
AM |
%S |
Two-digit seconds of the minute |
15 |
%U |
Two-digit week of the year where Sunday is the first day of the week |
48 |
%w |
Day of the week where Sunday is 0 |
0 |
%W |
Two-digit week of the year where Monday is the first day of the week |
47 |
%x |
The date |
Dec 2 1979 |
%X |
The time |
06:55:15 |
%y |
Two-digit year of the century |
79 |
%Y |
The year |
1979 |
%Z |
The name of the time zone, if known |
EST |
%% |
The percent character |
% |
Example
The following example displays the full day name and month name of the current day: var TimeBuf; Clib.strftime(TimeBuf,"Today is %A, and the month is %B", Clib.localtime(Clib.time())); TheApplication().RaiseErrorText(TimeBuf);
The display would be similar to: Today is Friday, and the month is July
The following example shows the use of different conversion characters to format the value returned by Clib.strftime. TheApplication().TraceOn("c:\\eScript_trace.txt","allocation","all"); var tm, tmStrFmt; tm = Clib.localtime(Clib.time());
Clib.strftime(tmStrFmt, "%m/%d/%Y",tm); TheApplication().Trace("Time String Format: " + tmStrFmt);
Clib.strftime(tmStrFmt, "%A %B %d, %Y",tm); TheApplication().Trace("Time String Format: " + tmStrFmt);
TheApplication().TraceOff();
The script produces trace output similar to the following. 03/05/04,12:44:01,START,7.5.3 [16157] LANG_INDEPENDENT,SADMIN,6848,6708 03/05/04,12:44:01,COMMENT,Time String Format: 03/05/2004 03/05/04,12:44:01,COMMENT,"Time String Format: Friday March 05, 2004" 03/05/04,12:44:01,STOP
See Also
Clib.asctime() Method Clib.localtime() Method
|