www.krengeltech.com

RXS_charToTimestamp

From Wiki

User Guide

Contents

Description

Use RXS_charToTimestamp to easily convert a timestamp coming from an XML document (i.e. string representation of a timestamp) to a valid IBM i/RPG timestamp format. This will save the headache of programming for all of the different timestamp formats out there and doing a bunch of sub-stringing and concatenation.

Prototype

     D RXS_charToTimestamp...
     D                 pr              z
     D  pString                      30a   value
     D  pFormat                      30a   value
     D  pDft                           z   value

Parameters

pString
Specify a variable name or character literal that came from the XML parsing process.
pFormat
Specify the format of the timestamp string so the converter knows where to pull each value. The idea is to combine the below keywords (i.e. yyyy, MM, dd, hh, mm, ss, SSSSSS) into a string that represents the location of where the corresponding value can be found in the string representation of the timestamp.
  • yyyy = Year
  • MM = Month
  • dd = Day
  • hh = Hour
  • mm = Minute
  • ss = Second
  • SS = Millisecond
pDft
If the string timestamp doesn’t match the format specified then the process cannot complete successfully and this default field’s value will be returned.

Return value

None.

Notes / Examples

     RXS_charToTimestamp(
       strTimestamp: 'yyyy-MM-dd-hh.mm.ss.SSSSSS': %timestamp());