GetAsString Method (DATETIME)


10.3A, PLBCMP GUI Only

 

The GetAsString method stores the time/date value from a DATETIME object into a string. The method uses the following format:

 

[label]

{object}.GetAsString

[GIVING {return}] USING [*Format=]{format},][:

 

 

[*LocalTime=]{localtime}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A DATETIME object that has previously been declared.

return

Optional. A Character String Variable that returns the formatted date and time string.

format

Optional. A Character String Variable or string literal that specifies the format of the returned string.

localtime

Optional. A Numeric Variable or decimal number that specifies if the DATETIME value should be set to local time or UTC.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is set to be TRUE if the {return} variable is too small and the data must be truncated.

  2. The OVER and ZERO flags are always cleared.

  3. The {format} string supports the following conversions:
     

  4. Format

    Description

    %a

    AM or PM

    %d

    day of month

    %m

    month (01 - 12)

    %y

    two digit year (00 -99)

    %Y

    four digit year (0000 - 9999)

    %f

    ** fractional seconds (SS.SSS)

    %H

    hour (00 - 24)

    %h

    hour (12 - 11)

    %M

    minute (00 - 59)

    %S

    seconds (00 - 59)

    %s

    seconds since 1970-01-01

    %P

    microseconds (000000 - 999999)

    %Z

    UTC

    %j

    day of year (000 - 366)

    %J

    julian day number

    %w

    day of week 0-6 (Sunday = 0)

    %W

    week of year (00 - 53)

    %%

    %

     

  5. The default {format} string is the ISO-8601 standard given as "%Y-%m-%dT%H:%M:%f%Z" (YYYY-MM-DDTHH:mm:ss.sssZ).

  6. If the {localtime} is one, the DATETIME value is expressed as local time. If the {localtime} is zero, the DATETIME value is expressed as UTC. If the {localtime} is not given, the DATETIME value is expressed as it was stored.

 

 

See Also: Method Syntax, DATETIME Methods

 



PL/B Language Reference Compare Method (DATETIME) SetAsString Method (DATETIME)