Solved

Why does converting a null from string to date result in 1/1/1970?

  • 24 October 2022
  • 4 replies
  • 321 views

Userlevel 1

When running strings through the Field Type Converter, going from string to date, if the string value is null the resultant date value is 1/1/1970. I would expect the date to also be null. Why am I not receiving a null output? Are dates not capable of being null?

icon

Best answer by alex.sanchez 25 October 2022, 15:58

View original

4 replies

Userlevel 2
Badge

Hi @mblahay

That's something common in Java, when creating a Date from a null input, it will be created with the default value which is the beginning of the linux epoch (1/1/1970).

 

You can use a stream selector to avoid the records containing a null date.

 

Thanks

Userlevel 1

Using a stream selector doesn’t work well. There are more than one date that needs conversion. To accomplish the task using the suggested work around I would need a type converter stage for each date, each with a stream splitter for bypassing the converter logic. Obviously I will need to figure something out for now, but for the future it might be good to add an option to the type converter to allow null values to pass through.

Userlevel 2
Badge

@mblahay, that is a very valid point, if you are a customer, please open a feature request, so we can speed things up in the prioritization

Userlevel 1

Recent evidence has prompted me to add onto this post. I have evidence that null value is NOT being converted to 1/1/1970, rather the date is simply how the UI displays the null value. Still not ideal from the standpoint of being able to visualize what is happening in the pipeline, but it is nice to know that underneath the covers I still have a null.

Reply