Time/Date

J

Jay

My table has a TimeInSec field (Time/Date datatype). This field has ALL
NEGATIVE numbers in seconds.

I used the following expression to change to regular time format.
Format ([TimeInSec]\3600,"00\:") & Format(([TimeInSec]\60) Mod 60,"00\:") &
Format([TimeInSec] Mod 60,"00")

How can I just put one minus (-) in front of regular time format?

Thank you.
 
M

Marshall Barton

Jay said:
My table has a TimeInSec field (Time/Date datatype). This field has ALL
NEGATIVE numbers in seconds.

I used the following expression to change to regular time format.
Format ([TimeInSec]\3600,"00\:") & Format(([TimeInSec]\60) Mod 60,"00\:") &
Format([TimeInSec] Mod 60,"00")

How can I just put one minus (-) in front of regular time format?

THere are more subtle ways to do this, but why not the
obvious:

Format(TimeInSec\3600,"00\:") & Format((-TimeInSec\60) Mod
60,"00\:") & Format(-TimeInSec Mod 60,"00")
 
P

peregenem

Marshall said:
THere are more subtle ways to do this, but why not the
obvious:

Format(TimeInSec\3600,"00\:") & Format((-TimeInSec\60) Mod
60,"00\:") & Format(-TimeInSec Mod 60,"00")

Subtle?

Format$(TimeInSec / 24 / 60 / 60, "-hh:mm:ss")
 
M

Marshall Barton

Format$(TimeInSec / 24 / 60 / 60, "-hh:mm:ss")


The issue with that approach is that it can not deal with
situations where TimeInSec is more than 24 hours.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top