Question
· Aug 31, 2023

Year stored is wrong while uploading data from CSV into IRIS

Hello Community,

I am trying to load data from a CSV into IRIS. I am using a record mapper. The CSV has 3 columns which are dates and I am using $ZDATEH() to convert the date columns to IRIS internal format. But the year that is getting loaded in IRIS is wrong. Example: if in my csv the date is "5/26/23", after data transformation and loading the data, date stored in the IRIS is "05/26/1923". The year getting stored is wrong, instead of 2023 the year getting stored is 1923. Can you please tell me how to solve this? Attaching screenshot of Data Transformation builder for reference.

Thank you!

Discussion (7)2
Log in or sign up to continue

There are provisions in the $ZDATEH function to cover the "two-digit-year" century issue. If you need all two-digit years to equate to 20xx, try this:

$ZDATEH("01/01/23",,,3,58074,94598)

As in, set the 'yearopt' parameter to 3, then set the startwin & endwin dates (in $H format) to the beginning and ending window to interpret the two-digit years.

If you need a specific range 100 year range - for this example, to evaluate two-digit years between 01/01/1950 and 12/31/2049, you'll need the $H values of those dates:

W $ZDATEH("1/1/1950")
39812
W $ZDATEH("12/31/2049")
76336

Then use those $H values in the window of the $ZDATEH command:

$ZDATEH("01/01/23",,,3,39812,76336)

Here's more documentation on the $ZDATEH command:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_fzdateh

Hope this helps!