Jump to content

Adding time values and displaying in correct order


tmfl

Recommended Posts

Hi,

 

I'm inserting hours and minutes per user into a database where they have their own fields.

(userid, hours, mins)

 

I've a small issue when displaying the data.

 

When I run my query I sum the total hours and minutes per user which results in data such as the following

 

userid1 - 2  hours 15 mins

userid2 - 1 hour 100 mins

 

The query orders by hours and then mins desc

 

When I'm displaying the data (as I'm looping through the results array) I perform a calculation to convert the mins to hours so it now reads

 

userid1 - 2 hours 15 mins

userid2 - 2 hours 40 mins

 

so the webpage displays userid1 first when i want userid2 to be the first record displayed (Hours desc)

 

Can anyone recommend a solution to this ?

Will I need to create another table and update it as hours and minutes are being entered and display results from that table instead ?

Can I order the data after I carry out the mins to hours calculation ?

 

many thanks in advance for any suggestions....

 

tmfl

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.