Time column - changing format.

Tools & Utilities

Time column - changing format.


In one table of our data warehouse there are 2 columns, "Sceduled Complete Time" and "Actual Complete Time".

Both these columns are in the format of "YYYY/MM/DD HH:MM:SS"

When the data is extracted the sql creates a new column based on "Actual Complete Time" - "Scheduled Complete Time" to give you the elapsed time. The format of this new column is (D HH:MM)

How do I make the new column so that it displays the elapsed time in Minutes only.

e.g. if the column shows "0 01:30" I want it to show "90"

Many thanks...

Tags (3)

Re: Time column - changing format.


Try this one

sel cast(cast(column_name as INTERVAL DAY TO minute) as interval minute(3))