ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

date format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • date format

    Hi all,

    I need to format a variable with a timestamp like this:

    YYYY-MM-DDThh:mm:ss.sssZ

    I've tried with varchar_format but it cannot put the T and Z

    Anyone can hel me?
    Many thanks.
    Bye

  • #2
    I resolve with this:

    Char(current date) concat 'T' concat substr(varchar_format(current timestamp, 'HH24:MM:SS.NNNNNN'), 1, 12) concat 'Z')

    is there a better solutions?
    Many thanks.

    Comment


    • #3
      Paolinosal,

      I have a table function I use to compare alike SQL statements. I did 10 million comparisons. The concatenation derived expression you showed was fastest.

      Jim

      Comment

      Working...
      X