Jump to content
We've recently updated our Privacy Statement, available here. ×

Expression/calculation function in Spotfire to convert a Date to DateTime

Iredia Osadolor

Recommended Posts

Is there an Expression/calculation function in Spotfire to convert a Date, data type String value eg. 20200218 to DateTime such as 2/18/2020 11:35:34 or 2-18-2020 11:35:34. I have tried using transform data->data table->change data types->add-new data types->DateTime->formatting to 2/18/2020 11:35:34 but the output came back empty.
Link to comment
Share on other sites

Use the DateTime() Function:

and substring :


Keep in mind that DateTime function only accepts Integers.

Returns the substring of Arg1 starting at index Arg2 with a length of Arg3 characters.



Substring("Hello", 2, 3)Creates a DateTime from a column or values. If a single argument is given, the input column can be of type String or Date. If a String is specified, the date must be written on a form that Spotfire can recognize and all parts of the date (year, month and day) must be present. If a Date is specified, the time part is set to 00:00:00.

If seven integer arguments are given, then the first argument is the year, the second is the month, the third is the day of the month, the fourth is the hour, the fifth is the minute, the sixth is the second and the seventh is the millisecond.




DateTime(2009, 05, 17, 11, 30, 20, 4)DateTime(

Integer(Substring([WO Created Date],1,4)),

Integer(Substring([WO Created Date],5,2)),

Integer(Substring([WO Created Date],7,2)),





Link to comment
Share on other sites

  • 6 months later...

You can use the ParseDateTime() expression function to create a DateTime Column fromthe String Column, and then use the DateAdd() expression function successively to add the "time" part 11:35:34.

DateAdd("ss", 34, DateAdd("mi", 35, DateAdd("hh", 11, ParseDateTime([WO Create Date], "yyyyMMdd"))))

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...