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

Number format time function

Hi all,

From the Google Analytics API I get total visits and total time on site. When I divide the total time on site by total visits I expect the average time on site.

But, and here is the question, the total time is: 1.014374E7. This number supposed to be the total seconds. But when I make an expression timeOnSite / visits it doesn't work.

I have already tried to format it into: interval(num#(metric_timeOnSite, '#.#' ,'.',',')/(24*60*60),'h:mm:ss'), but that gives me null.

Any thoughts on this? Thanks in advance.

Regards,

Henco


1 Solution

Accepted Solutions
swuehl
MVP
MVP

Henco,

please take care of the decimal point format and thousand separator. Again, I think the initial load used the wrong settings.

I fixed this with a num#() function, but I would prefer to handle this with standard format settings.

Then you can evaluate your timeOnSite to get the scientific notation correctly in.

Please see also attached.

Stefan

View solution in original post

4 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Did you tried with this?

     interval(num(metric_timeOnSite)/(24*60*60),'h:mm:ss')

If it didn't works then try with this.

interval((num(SubField(metric_timeOnSite,'E',1))*pow(10,SubField(metric_timeOnSite,'E',2)))/(24*60*60),'h:mm:ss')

Hope it helps

Celambarasan

Anonymous
Not applicable
Author

Hi Celambarasan,

Thanks for your reply. Unfortunately both of them don't work.

Find attached the sample document, with the values in it.

Regards,

Henco

swuehl
MVP
MVP

Henco,

please take care of the decimal point format and thousand separator. Again, I think the initial load used the wrong settings.

I fixed this with a num#() function, but I would prefer to handle this with standard format settings.

Then you can evaluate your timeOnSite to get the scientific notation correctly in.

Please see also attached.

Stefan

Anonymous
Not applicable
Author

Thank you very much Stefan.

You helped me out!

Regards,

Henco