Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Need help subtracting time values

Excel 2000
Windows 2k Pro

I have a column of time values in a dbf file from a GPS unit. The time
values are in military time format, i.e. "16:34:27" and they are written to
the dbf as string values. I'm having a hard time figuring out how to do
simple subtraction with them. Should I store them as String values or as
Variants? I've tried both with little success. Any help greatly
appreciated. Thanks!

-gk-



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Need help subtracting time values

You could store them as Date... Subtraction can be performed on Dates and
you can do date/time formatting with it too.

Sub test()
Dim dtm1 As Date, dtm2 As Date

dtm1 = CDate("12:30:00")
dtm2 = CDate("16:34:27")

MsgBox Format(dtm2 - dtm1, "hh:mm:ss")
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"TBA" wrote in message
...
Excel 2000
Windows 2k Pro

I have a column of time values in a dbf file from a GPS unit. The time
values are in military time format, i.e. "16:34:27" and they are written

to
the dbf as string values. I'm having a hard time figuring out how to do
simple subtraction with them. Should I store them as String values or as
Variants? I've tried both with little success. Any help greatly
appreciated. Thanks!

-gk-





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtracting Time Kris Excel Discussion (Misc queries) 5 November 17th 08 06:35 PM
Subtracting a duration from a time to calculate a time. SRadmin Excel Discussion (Misc queries) 5 October 2nd 08 08:04 PM
Subtracting Dates to get total time work time excluding weekends Jon Ratzel[_2_] Excel Discussion (Misc queries) 2 January 31st 08 10:36 PM
SUBTRACTING TIME VALUES INSTEAD OF DECIMAL!! Lexicon Excel Discussion (Misc queries) 8 April 19th 05 08:06 PM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"