Skip to main content
Question

Combine ERDAT and ERZET fields into single timestamp

  • July 11, 2025
  • 1 reply
  • 23 views

emily.helve
Level 1
Forum|alt.badge.img

Using PQL in the VBFA table, I need to combine the date and time into a single timestamp.

Both the ERDAT (date) and  ERZET (time) fields are formatted as complete timestamps in our data model.

I succeeded by converting both fields to strings, combining them, then converting the combined string back to a date.

TO_DATE(TO_STRING ("VBFA"."ERDAT" , FORMAT ( '%Y-%m-%d' ) )||' '||TO_STRING("VBFA"."ERZET", format ('%H:%M:%S')), FORMAT ( '%Y-%m-%d %H:%M:%S' ) )

Is there a more direct approach I could use to obtain the same result? The conversion to string seems  unnecessary.

Thank you.

1 reply

Forum|alt.badge.img+3

if both ERDAT and ERZET are stored as proper date and time types, you can directly use "VBFA"."ERDAT" + "VBFA"."ERZET" ,If ERZET is not a time type, your original TO_DATE(TO_STRING(...)) method is necessary.