Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2006, 12:33 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting military times to numbers

I have a column that contains times in military format. I want to convert the times to numbers, with no formatting.

For example:

Right now the columns show the following:

0:01
0:23
2:14
13:32
19:54

Their actual values are:

12:01:00 AM
12:23:00 AM
2:14:00 AM
1:32:00 PM
7:54:00 PM

I want it to instead have the following values:

1
23
214
1332
1954

They should be formatted as numbers, with no indication that they represent times.

Is this possible?

I have a worksheet that contains military times in number format that I need to compare against.

Thanks.
 
Old April 6th, 2006, 01:47 AM
Authorized User
 
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Use DateDiff function e.g.: DateDiff("n","00:00:00",<your date>)
for more information see MSDN

Peko






Similar Threads
Thread Thread Starter Forum Replies Last Post
Unique Key by concatenating military time and date code_lover C++ Programming 0 August 8th, 2008 06:09 AM
Converting numbers to text mylifeishz Visual Basic 2005 Basics 1 July 5th, 2008 10:57 AM
converting numbers to words ali_md SQL Server 2000 4 March 3rd, 2006 02:10 AM
script times out dazednconfused Beginning PHP 12 August 27th, 2003 07:32 AM
Local times pow1983 Forum and Wrox.com Feedback 4 June 9th, 2003 11:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.