Skip to main content
OneStream Employee
Oct 26, 2021 9:52 AM UTC
Solved

How can I convert excel date integers into DateTime

I have a csv import coming from excel. One of the columns is of type date but when it gets saved into CSV the date is replaced by integers in the format excel uses to store dates. How can I convert those integers back into dates?

tsandiAnswer
OneStream Employee
Oct 26, 2021 9:55 AM UTC

You can use a complex expression in the data source column itself to convert the date:

Dim excelDate As Integer = args.Value
Return DateTime.FromOADate(excelDate)

This will return the correct date format in stage:

tsandi_0-1635242034101.png

Original dateset:

tsandi_1-1635242083284.png

 

1 reply

tsandiOneStream EmployeeAuthorAnswer
OneStream Employee
Oct 26, 2021 9:55 AM UTC

You can use a complex expression in the data source column itself to convert the date:

Dim excelDate As Integer = args.Value
Return DateTime.FromOADate(excelDate)

This will return the correct date format in stage:

tsandi_0-1635242034101.png

Original dateset:

tsandi_1-1635242083284.png