Siebel eScript Language Reference > C Language Library Reference > Clib Date and Time Methods >

Clib Get Formatted Date and Time Method


The Clib Get Formatted Date and Time method creates a string that includes the date, time, or the date and time. It returns a formatted string that contains these values.

Format

Clib.strftime(stringVar, formatString, Time)

Table 179 describes the arguments for the Clib Get Formatted Date and Time method.

Table 179. Arguments for the Clib Get Formatted Date and Time Method
Argument
Description

stringVar

A variable that holds the time in a string.

formatString

A string that describes how to format the value in the stringVar argument. Conversion characters represent this format. For more information, see Conversion Characters That the Return Formatted Date and Time Method Uses.

Time

A time object that the Clib Convert Integer to Local Time method returns. For more information on the time object, see Overview of Clib Date and Time Methods.

Conversion Characters That the Return Formatted Date and Time Method Uses

Table 180 describes conversion characters that the Return Formatted Date and Time method uses.

Table 180. Conversion Characters That the Return Formatted Date and Time Method Uses
Character
Description
Example

%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 percentage symbol.

%

Example 1

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 is similar to the following:

Today is Friday, and the month is July

Example 2

The following example uses various conversion characters to format the value that the Clib Get Formatted Date and Time method returns:

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();

This example produces the following result:

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

Siebel eScript Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.