Convert date field to minutes

C

ChuckW

Hi,

I have a text field that has a format of 00:00:00 where
the first two zeros on the left are days, the second two
are hours and the third pair are minutes. So 00:01:30 is
one hour and 30 minutes or 90 minutes. What I want to do
is to create a query which will convert the value in this
field to minutes. Can anyone help?

Thanks,

Chuck
 
R

Rick B

I guess you could do something like....


=val(Left([your field])*1440 + val(Mid([yourfield],4,2)*60) +
val(right([yourfield],2)


I'm not 100% on the "val" part. I think that returns the value of a string.
 
V

Van T. Dinh

Try:

CInt( Left([YourField], 2) ) * 1440 +
CInt( Mid([YourField], 4, 2) ) * 60 +
CInt( Right([YourField], 2) )

(typed as one line - multiple lines on the post for clarity.)
 

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