Question Patty Aguirre-Romero · Sep 11, 2024

Change Date Format from YYYYMMDDHHMMSS to YYYYMMDD in a DTL

Greetings,

Is it possible to change the date format from YYYYMMDDHHMMSS to YYYYMMDD in a DTL? How?

I tried ConvertDateTime() without success. 

I'm using Iris for Health

Thank you!

Product version: IRIS 2023.3
$ZV: 2023.1.3

Comments

Jeffrey Drumm · Sep 11, 2024

I'm not sure why ConvertDateTime() failed; informat should be "%Y%m%d%H%M%S" and outformat "%Y%m%d" for your example transformation. Regardless, you can also use $EXTRACT(<sourcedate>,1,8). There's also the SubString() method in the DTL function list, which takes the same arguments.

0
Patty Aguirre-Romero  Sep 12, 2024 to Jeffrey Drumm

Thank you Jeffrey!

Late in the day yesterday, I figure out this was missing in my configuration: $e

I was able to set up ConvertDateTime function correctly like this: 

ConvertDateTime($e(source.{PID:DateTimeofBirth},1,8))

0
Jeffrey Drumm  Sep 12, 2024 to Patty Aguirre-Romero

$E is the shorthand version of $EXTRACT ...

ConvertDateTime(source.{PID:DateTimeOfBirth},"%Y%m%d%H%M%S","%Y%m%d") should work just fine.$E(source.{PID:DateTimeOfBirth},1,8) by itself should provide the same result.

But ConvertDateTime($e(source.{PID:DateTimeofBirth},1,8)) is basically taking the 8-digit date returned from $E() and converting it without any input and output patterns ... which gets you the exact same 8-digit date.

0
Carlotta McCormick · Mar 26

Patty - just an FYI but I also had the same issue with ConvertDateTime by itself, and also had to use the extract function with it.  Not sure why it doesn't seem to work by itself but thanks for the response with the working answer - I appreciate it!

0