Previous Topic: TEXTSTRING Statement—Specify a Text String to Search ForNext Topic: TIMEOUT Statement—Specify the Ping Timeout


TIMEFORMAT Statement—Define a Time Format

The TIMEFORMAT statement defines the date and time pattern to use when searching a text file with a time stamp.

Supported Job Type

If the DATETIME operand is specified in a SEARCHRANGE statement, this statement is required for the Text File Reading and Monitoring job type.

Syntax

This statement has the following format:

TIMEFORMAT timeformat [TIMEPOS(timepos)]
timeformat

Defines the date and time pattern to use when the upper and lower boundaries are specified as date and time. The upper and lower boundaries are used to search inside a log file.

Limits: Up to 256 characters; case-sensitive

TIMEPOS(timepos)

Specifies the first column of the time stamp in the log file.

Notes:

Time Format Pattern Characters

Character

Definition

Type

Example

G

Era designator

Text

AD

y

Year

Number

2010

M

Month in year

Text and Number

July; 07

d

Day in month

Number

10

h

Hour in am/pm (1 to 12)

Number

12

H

Hour in day (0 to 23)

Number

0

m

Minute in hour

Number

30

s

Second in minute

Number

55

S

Millisecond

Number

978

E

Day in week

Text

Tuesday; Tues

D

Day in year

Number

189

F

Day of week in month

Number

2 (2nd Wednesday in July)

w

Week in year

Number

27

W

Week in month

Number

2

a

AM/PM marker

Text

PM

k

Hour in day (1 to 24)

Number

24

K

Hour in AM/PM (0 to 11)

Number

0

z

Time zone

Text

EST; Eastern Standard Time

Z

RFC 822 time zone

Sign and Number

-0500

'

Escape for test

Delimiter

 

''

Single quote

Literal

'

Format Pattern

Result

"yyyy.MM.dd G 'at' hh:mm:ss z"

2010.07.10 AD at 12:08:56 EST

"EEE, MMM d, ''yy"

Wed, July 10, '10

"h:mm a"

12:08 PM

"hh 'o''clock' a, zzzz"

12 o'clock PM, EST

"K:mm a, z"

12:08 PM, EST

"yyyyy.MMMMM.dd GGG hh:mm aaa"

2010.July.10 AD 12:08 PM

Example: Define a Time Format

In this example, the TIMEFORMAT statement specifies the time pattern format that is applied to the values specified by the FROM and TO operands of the SEARCHRANGE statement. The time values are enclosed in single quotation marks because they contain spaces.

The values for the TIMEFORMAT statement are as follows:

The job completes successfully if the string is found.

AGENT SYSAGENT
TEXTFILE '/export/home/cybermation/agentdir/log/transmitter.log'
TEXTSTRING NTAGR6 EXIST
SEARCHRANGE DATETIME+
FROM('08/17/2010 00:00:00.000 EST-0500')+
TO('08/25/2010 23:59:59.999 EST-0500')
TIMEFORMAT 'MM/dd/yyyy HH:mm:ss.SSS zZ' TIMEPOS(1)