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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.