Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert Fraction to Time

Hi all,

I need to convert a fraction into time format. 

For example, I have 1.75 (1hr 45mins) and need to convert it to 1:45

or

2.25 should be "2:15" (which is 2 hours 15 minutes).

Many thanks in advance,

Matt

1 Solution

Accepted Solutions
MayilVahanan

Hi,

     Try this,

     = Time(([Fraction field]/24), 'hh:mm')

    for example, = Time((1.75/24),'hh:mm') gives 01:45

Hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
MayilVahanan

Hi,

     Try this,

     = Time(([Fraction field]/24), 'hh:mm')

    for example, = Time((1.75/24),'hh:mm') gives 01:45

Hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi both, thank you but that doesnt seem to work. 

Just to add: I need to do this for all the values in a specific colum in my raw data, so I should probably build this into the script and call it "as Converted_Time,"... do you know how I can do this within the script?

Many thanks,

Matt

MayilVahanan

Hi,

     Try this,

          Load * , Time([FractionField]/24,'hh:mm') as Converted_Time from [Tablename];

For example,

temp:
load * inline
[
fraction
1.75

2.25
];

Load Time((fraction/24),'hh:mm') as Convert_time Resident temp;

Hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Check with this

     Load

          Time#(Floor(FractionField)&':'&(Frac(FractionField)*60),'h:m') AS Converted_Time

     .

     .

     FROM ....

Celambarasan