Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

convert_locale_date()

Convert international date and time formats to the number of seconds that have elapsed since 00:00:00 GMT January 1, 1970.

Syntax

convert_locale_date(date_string,[format])

Parameters

Parameter

Definition

date_string

string representing a date

format

one or more symbols that describe the format of date_string For a list of format symbols, see Format Symbols for convert_locale_date(). Each symbol is composed of a percent (%) sign followed by one or two characters. If you use more than one symbol, separate each symbol by a space. 

Default 
day month date time year (Fri Jan 2 08:00:00 1970)

Description

The convert_locale_date() function converts a date string to the number of seconds that have elapsed since 00:00:00 GMT January 1, 1970. 

The convert_locale_date() function serves the same purpose as convert_date(). With convert_locale_date(), however, you can use the format symbols listed inthe following table to define the format of the date_string parameter. These format symbols provide the flexibility required to enter international date and time formats. 

If you do not use the format parameter, convert_locale_date() accepts the format used by the PSL date() function (day month date time year).

Note

 

This function provides support for internationalized PSL scripts. For more information about internationalization, see Internationalized PSL Scripts.

 Format Symbols for convert_locale_date() 

Format Symbol

Description

%%

allows you to use a percent sign (%) in the format of a date string

%a

locale's name of the day of week; either the abbreviated or full name may be specified.

%A

same as %a

%b

locale's name of the month; either the abbreviated or full name may be specified.

%B

same as %b

%c

locale's appropriate date and time representation

%C

century number [0,99]; leading zero is permitted but not required (no change to tm)

%d

day of month [1,31]; leading zero is permitted but not required

%D

date as %m/%d/%y

%e

same as %d

%h

same as %b

%H

hour (24-hour clock) [0,23]; leading zero is permitted but not required

%I

hour (12-hour clock) [1,12]; leading zero is permitted but not required

%j

day of year [1,366]; leading zeros are permitted but not required

%m

month as a decimal number [1,12]; leading zero is permitted but not required

%M

minute [0,59]; leading zero is permitted but not required

%n

any white space

%p

locale's equivalent of either a.m. or p.m.

%r

appropriate time representation in 12-hour clock format with %p

%R

time as %H:%M

%S

seconds [0,61]; leading zero is permitted but not required

%t

any white space

%T

time as %H:%M:%S

%U (UNIX or Linux OS only)

week of the year as a decimal number [0,53], with Sunday as the first day of the week; leading zeros are permitted but not required (no change to tm)

%w

day of week as a decimal number [0,6], with 0 representing Sunday

%W

week of the year as a decimal number [0,53], with Monday as the first day of the week; leading zero is permitted but not required (No change to tm)

%x

locale's appropriate date representation

%X

locale's appropriate time representation

%y

year within the century [0,99]; leading zero is permitted but not required

%Y

year, including the century (for example 1993)

%Z

name of time zone, or no characters if no information of the time zone exists

Example

The following example demonstrates the convert_locale_date() function:

set_locale("TIME", "C");
ret = convert_locale_date("Fri Feb 2 08:00:00 1970");
printf("\nConvert date results: locale = C,
date = Fri Jan 2 08:00:00 1970, and
converted date = %s\n", ret);
ret=convert_locale_date("13:11:00 2 2001","%T %j %Y");
printf("\nConvert date results: locale = C,
date = 1:11 PM Jan 2, 2001, and
converted date = %s\n", ret);



The following is the output from the previous example.

Convert date results: locale = C,
date = Fri Jan 2 08:00:00 1970, and
converted date = 2815200
Convert date results: locale = C,
date = 1:11 PM Jan 2, 2001, and
converted date = 978289860
Was this page helpful? Yes No Submitting... Thank you

Comments