• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

convert time to seconds in MS access

I have a table with times

Is there an easy way to convert a time to seconds in Access 2003?  For example if the time was 2:30 pm the seconds would be 52200
0
johnnyg123
Asked:
johnnyg123
  • 3
  • 2
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
DateDiff("s", <your time> - Fix(<your time>), <your time>)
JimD.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Sorry, that's not quite right.  It's simply:
DateDiff("s", Fix(<your time>), <your time>)
JimD.
0
 
Rey Obrero (Capricorn1)Commented:
i think you have to based the calculation using #00:00# as the initial time

datediff("s",#00:00#,#yourtime#)
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
johnnyg123Author Commented:
I tried the following to see what using current time would result in

SELECT DateDiff("s",Now()-Fix(Now()),Now())

but got #error

not sure what I'm doing wrong
0
 
johnnyg123Author Commented:
posted my question before did a refresh

Jimd you are correct

DateDiff("s",Fix([ConnectedDate]),[connecteddate])

worked great!
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Do:
 SELECT DateDiff("s",Fix(Now()),Now())
 and make sure your app compiles.
JimD.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now