Jump to content

Deduct ms access querys hort date from medium date


shocker-z

Recommended Posts

Hi,

 

Is there a way that i could calculate the amount of hours between 2 fields either within a ms access odbc query in php or even in the query?

 

I've tryed using this

 

  $curID=15414;
$getcalls="SELECT Maintenance_ID, [Allocated To], left([Date Closed],10) as `closed`, ([Date Closed] - [Date Logged]) as sla FROM Maintenance_Dbf
            WHERE Maintenance_ID = $curID";

 

but this returns -0.441180555557366

 

I think the problem that you i need to bear in mind is that Date Logged is a shortdate and Date Closed is a Medium date example of the date which are used in query above are as follows.

 

Date Logged - Short Date - 01/06/2007 10:35:18

DATE Closed - Medium Date - 2007-06-01 00:00:00

 

i do have a time closed which could be appended when time show's 00:00:00 and then possibly put into a temperary mysql database to be calculated in?

 

 

I know this is going to be a work around rather than a fix but unfortunatly my director made the database and has modified it in access for 4 years so is hard to make changes to make it better as theres always somthing else that goes wrong and access is what he knows and the database is his litle baby. Would be LOADS better as MSSQL or even MySQL only 10 users use it.

 

 

 

Regards

Liam

Anyone?

 

Another way of explaining it is how do people do it on forums where it says "posted 5hours 24minutes ago"? as i can construct the correct date/time stamp but need to know how to deduct 1 off the other?

 

 

Regards

Liam

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.