Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I would like to highlight an issue while using the dynamic datatype.
While using the dynamic datatype , we can specify the date pattern , but there seems to be an issue while handling both date and timestamp formats.
For example , on specifying the date pattern to "yyyy-MM-dd HH:mm:ss" , the columns having only the date (2nd column in the example) also get converted to timestamp.
I want to retain both the date and timestamp formats. I'm currently extracting the contents of the table into a file
Below is a scenario :
Input :
ID|DT_PAT|TMSTMP_PAT
1|2022-01-25|2022-01-25 23:59:59
2|2022-01-23|2022-01-23 23:59:59
3|2022-01-20|2022-01-20 23:59:59
Current output with date pattern ("yyyy-MM-dd HH:mm:ss" ) with dynamic datatype :
ID|DT_PAT|TMSTMP_PAT
1|2022-01-25 00:00:00|2022-01-25 23:59:59
2|2022-01-23 00:00:00|2022-01-23 23:59:59
3|2022-01-20 00:00:00|2022-01-20 23:59:59
Expected Output :
ID|DT_PAT|TMSTMP_PAT
1|2022-01-25|2022-01-25 23:59:59
2|2022-01-23|2022-01-23 23:59:59
3|2022-01-20|2022-01-20 23:59:59
Thanks in advance
How are you getting the output data? Where is this coming from? Is it your job (via a tLogRow or similar) or is it from a database analyser or file?
Hi Rhall,
Input is Oracle. Output is generated in delimited file through the job
OK, this looks like a formatting issue. The Date class holds full dates down to time. It is essentially holding a number. If you supply a date without a time element, the Date class will still appear to hold a time element as in reality, it is just holding a number. There is nothing wrong here, you just need to set the date format for fields you want to see represented as Strings to "yyyy-MM-dd".