Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extract HH:MM from time when loading

I have a field called "Time_24" formated HH:MM:SS.  When loadind in the script, I want to create a new field that only tracks HH:MM (I don't care about seconds).  How do I make this happen in the load statement?

[Dim Time of Day]:

LOAD

    "Time_Of_Day_Key"                                                   

    "Time_24",                                                          

          Hour ("Time_24")                                               AS HOUR,

          Minute("Time_24")                                             AS MIN,

I want to add SOMETHING MAGIC FORUMLA               AS HH:MM;

SQL SELECT *

FROM "Website_Usage_DW".dbo."Dim_Time_Of_Day";

Thanks!

Suzan

1 Solution

Accepted Solutions
Gysbert_Wassenaar

There are several options

time(Time_24,'hh:mm') as hh_mm will keep the numeric value of the time and also format it as hh:mm

hour(Time_24) & ':' & num(minute(Time_24),'00') as hh_mm will create a string value.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

There are several options

time(Time_24,'hh:mm') as hh_mm will keep the numeric value of the time and also format it as hh:mm

hour(Time_24) & ':' & num(minute(Time_24),'00') as hh_mm will create a string value.


talk is cheap, supply exceeds demand