Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

converting decimals to seconds

I have an Excel spreadsheet with a column that says 2:49, 2 minutes and 49 seconds. When I try

to pick the minutes and seconds I get a strange result. When formatting the cell in Excel I can see

0,00833333333333333. How do I get this to minutes and seconds in my script? Is there any formula

to convert?

kindly

Håkan

1 Solution

Accepted Solutions
MVP
MVP

Re: converting decimals to seconds

Hi

A time value is a decimal number of days where the fractional part represent the time of day (1 = 24h or 1440 minutes). As Manish said, Time() will display the value in hh:mm:ss format.

If you need the minutes value for a calculation, then use something like:

     ...

     YourFIeldName * 1440 As Minutes,

     ...

will give you a decimal minute value.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
2 Replies

Re: converting decimals to seconds

UI SIDE

TIME(YourFIeldName,'hh:mm:ss') or

TIME(YourFIeldName,'mm:ss')

SCRIPT SIDE

TIME(YourFIeldName,'hh:mm:ss') as YourFIeldName or

TIME(YourFIeldName,'mm:ss') as YourFIeldName

MVP
MVP

Re: converting decimals to seconds

Hi

A time value is a decimal number of days where the fractional part represent the time of day (1 = 24h or 1440 minutes). As Manish said, Time() will display the value in hh:mm:ss format.

If you need the minutes value for a calculation, then use something like:

     ...

     YourFIeldName * 1440 As Minutes,

     ...

will give you a decimal minute value.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser