Time format conversion

61 views
Skip to first unread message

cliff dee

unread,
Nov 5, 2025, 11:00:57 AMNov 5
to golden-cheetah-users
Hi all 

I am modifying a summary dashboard to show the difference between  Duration and "Time Moving" the calculation is working but not the formatting.

Any tips on formatting the new field as a time and labelling the new field correctly ?

Below is the code I have 

{


# column names, if using metrics then best

# to use metricname() to get correct name for locale

# otherwise it won't translate to other languages

names {


metricname(

Duration,

Time_Moving,

Time_Moving,   #how do I creat a custom metricname ?

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain

);


}


# column units, if using metrics then best

# to use metricunit() function to get correct string

# for locale and metric/imperial

units {


metricunit(

Duration,

Time_Moving,

Duration,

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain

);

}


# values to display as doubles or strings

# if using metrics always best to use asstring()

# to convert correctly with dp, metric/imperial

# or specific formats eg. rowing pace xx/500m

values {

c(


asaggstring(

Duration,

Time_Moving),


Duration - Time_Moving ,

asaggstring(

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain)

);

}


}


Ale Martinez

unread,
Nov 5, 2025, 11:10:10 AMNov 5
to golden-cheetah-users
El miércoles, 5 de noviembre de 2025 a la(s) 1:00:57 p.m. UTC-3, cliff...@gmail.com escribió:
Hi all 

I am modifying a summary dashboard to show the difference between  Duration and "Time Moving" the calculation is working but not the formatting.

Any tips on formatting the new field as a time and labelling the new field correctly ?

To do the conversion in formulas see https://github.com/GoldenCheetah/GoldenCheetah/wiki/UG_Special-Topics_Formula-Syntax-and-Expressions#converting-date-and-time-values-to-strings, for KPI tiles there is a "Time" checkbox to enable the conversion without modifying the formula.

cliff dee

unread,
Nov 6, 2025, 12:18:32 PMNov 6
to golden-cheetah-users
Hi Thanks for the help worked like a charm.

The  timestring function did the trick.

Below is the code if anyone wants a trend that incudes stopping time.

{


# column names, if using metrics then best

# to use metricname() to get correct name for locale

# otherwise it won't translate to other languages

names {

c(

metricname(

Duration,

Time_Moving),

(

"Time_Stopped"),

metricname(

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain)

);


}


# column units, if using metrics then best

# to use metricunit() function to get correct string

# for locale and metric/imperial

units {


metricunit(

Duration,

Time_Moving,

Duration,

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain

);

}


# values to display as doubles or strings

# if using metrics always best to use asstring()

# to convert correctly with dp, metric/imperial

# or specific formats eg. rowing pace xx/500m

values {

stoptime <- aggmetrics(Duration) - aggmetrics(Time_Moving);

c(


asaggstring(

Duration,

Time_Moving),

timestring(

stoptime) ,


asaggstring(

Distance,

Activities,

Work,

W'_Work,

Elevation_Gain)

);

}


}



Reply all
Reply to author
Forward
Message has been deleted
0 new messages