38.9.4.10 Read Time as STRING

Function that obtains the display unit's current time as a character string (LPTSTR format). This function is valid only with the time stored in LS2048 (6 words).

Function Name

DWORD WINAPI EasyGetGPTimeString(LPCSTR sNodeName, LPCSTR sFormat, LPSTR osTime);

Argument

sNodeName: The station name is fixed as #WinGP.

pFormat: Retrieves string as a time formatted string. Formatting codes following the percent sign (%) are replaced with "Special Item."
Other characters are not converted and display as is.

osTime: Time obtained as text.

LOSS OF DATA

  • If you do not have enough space for the retrieved text length +1 (Null), an unexpected memory space error will occur. Make sure you reserve enough memory space for the expected string length +1 (for the NULL character). If you don't reserve enough space, you could experience unexpected data loss and operations may not work properly.

Failure to follow these instructions can result in equipment damage.

Return value (NULL)

Normal End: 0

Problem: Error code

Special Item

Formatting codes following the percent sign (%) are replaced as shown in the following table. Other characters are not converted and display as is. For example, if the clock is 2006/1/2 12:34:56 and you define %Y_%M %S, the string becomes:

Formatting Code

Folder

%a

Day - abbreviated (*2)

%A

Day (*2)

%b

Month - abbreviated (*2)

%B

Month (*2)

%c

Locale-related date and time

%#c

Locale-related date and time (long form)

%d

Date as decimal value (01 to 31) (*1)

%H

24 Hour Clock (00 to 23) (*1)

%I

12 Hour Clock (01 to 12) (*1)

%j

Day of year as decimal value (001 to 366) (*1)

%m

Month as decimal value (01 to 12) (*1)

%M

As decimal value (00 to 59) (*1)

%p

AM/PM for locale (*2)

%S

As decimal value (00 to 59) (*1)

%U

Week of year as decimal value. The first Sunday of the year is the first week. (00 to 53) (*1)

%w

Day as decimal value. Sunday is 0 (0 to 6) (*1)

%W

Week of year as decimal value. The first Monday of the year is the first week. (00 to 53) (*1)

%x

Date of current locale

%#x

Date of current locale (long form)

%X

Time of current locale (*2)

%y

2-digit Year as decimal value (00 to 99) (*1)

%y

4-digit Year as decimal value (*1)

%z, %Z

Time zone or time-zone abbreviation. When time zone is unknown, character is not entered (*2)

%%

Percentage symbol (*2)

*1 Suppress leading zeroes by placing a hash mark (#) in front of d, H, I, j, m, M, S, U, w, W, y, or Y. (For example, if the value is 05, and the formatting code is %#d, displays 5.)

*2 The hash mark is ignored when it is placed (for example, %#a) in front of a, A, b, B, p, X, z, or Z.