Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Access\SQL date time conversion

Author  Topic 

murray adamson
Starting Member

2 Posts

Posted - 2002-09-24 : 17:37:56
I have a problem with date time conversion.
When the data is imported into access adp project it turns up as
30/9/1899 11:22PM
The 30/9/1899 is placed on the time by Sql as it imports the data into the Project and it also converts it to AM/PM instead of leaving it in 24 hour format.
The format I need is 23:22 for conversion to minutes.
I can format the data to only display in this format, but this doesn't solve the problem.
I need to convert hours to minutes and then add the minutes to this value to get total minutes time since midnight.
Once in total minute format I can then compare times directly for statistical purposes. This involves simple subtraction or addition of the total minute values.
While it is possible to convert to char and then cut up with string functions,then convert back to numeric values, this method is time consumming and long winded.
Can anybody suggest a better way of doing this.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-09-24 : 17:57:54
You don't need to convert times to minutes or seconds only. Use the DateDiff() function to find the difference between two datetime values.

As far as date/time formats are concerned, you can change the format through your Windows control panel, or set it in your Access form or query grid window. Look in the Access help file for the "format function", it will describe what settings are available and how to apply them.

Go to Top of Page

murray adamson
Starting Member

2 Posts

Posted - 2002-09-24 : 22:25:47
Thanks, that works perfectly for finding the time minute differences, knew there must have been a simple method.

Go to Top of Page
   

- Advertisement -