Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Convert to military time - part II

I am trying to convert MM/DD/YYYY H:mm:ss AM/PM to military time. I copied
the macro provided by Bernie Deitrick to Soccer Star, and got the same error
message with ..Value = TimeValue(TimeStr). I've named the start time
TimeStr, but don't know what to do next.

TIA,

Carole O
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Convert to military time - part II

Hi,
You can just format the cells containing the military times:
-select the cells (or entire column)
-menu Format Cells, tab Number:
-choose Time as category
- choose a non-AM/PM type, eg: 13:30:55

Regards,
Sébatien

"Carole O" wrote:

I am trying to convert MM/DD/YYYY H:mm:ss AM/PM to military time. I copied
the macro provided by Bernie Deitrick to Soccer Star, and got the same error
message with ..Value = TimeValue(TimeStr). I've named the start time
TimeStr, but don't know what to do next.

TIA,

Carole O

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Convert to military time - part II

to elaborate. There is no military time or AM/PM time. There is only time.
Time is stored as fraction of a 24 hour day, so if a .5 is stored, it is 1/2
a day or 12:00 PM. You can then format the cell to display in any supported
manner.

any whole numbers in the value indicate the number of days from a base date.
The default is midnight just before 1/1/1900 so 1.5 would be 1/1/1900
12:00:00 AM/PM

38221.25 in a cell formatted as a date/time would be Aug 12, 2004 8:00:00
AM. you can format it to display anyway you want, including military time.

--
Regards,
Tom Ogilvy



"sebastienm" wrote in message
...
Hi,
You can just format the cells containing the military times:
-select the cells (or entire column)
-menu Format Cells, tab Number:
-choose Time as category
- choose a non-AM/PM type, eg: 13:30:55

Regards,
Sébatien

"Carole O" wrote:

I am trying to convert MM/DD/YYYY H:mm:ss AM/PM to military time. I

copied
the macro provided by Bernie Deitrick to Soccer Star, and got the same

error
message with ..Value = TimeValue(TimeStr). I've named the start time
TimeStr, but don't know what to do next.

TIA,

Carole O



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Convert to military time - part II

Please, disregard my previous post.

-What is your input:
you have a date data type variable or a date in a string ? if string, in
which format?
-What do you want as output:
a string (containing a date) formatted as MM/DD/YYYY H:mm:ss AM/PM ?

I suppose you can use the Format function. Example:
Dim d as date
d=Now()
msgbox "US: " & format(d, "mm/dd/yyy h:mm:ss AM/PM")
msgbox "Military: " & format(d, "mm/dd/yyy h:mm:ss")

Regards,
Sebastien

"Carole O" wrote:

I am trying to convert MM/DD/YYYY H:mm:ss AM/PM to military time. I copied
the macro provided by Bernie Deitrick to Soccer Star, and got the same error
message with ..Value = TimeValue(TimeStr). I've named the start time
TimeStr, but don't know what to do next.

TIA,

Carole O

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
Is there an XLS function to convert std time to Military time? Carl Excel Worksheet Functions 1 May 20th 09 09:48 PM
convert military time to regular hours Kathy Excel Worksheet Functions 1 April 25th 06 01:20 PM
Convert to Military time? telewats Excel Discussion (Misc queries) 2 March 13th 06 06:17 PM
Convert data into standard military time format geog Excel Discussion (Misc queries) 2 December 12th 05 07:46 PM
How do I convert Military Time to minutes? Rachael Excel Worksheet Functions 1 January 6th 05 10:01 PM


All times are GMT +1. The time now is 04:25 AM.

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"