+ Reply to Thread
Results 1 to 5 of 5

Covert date/time to military time hour only

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    sin city
    MS-Off Ver
    Excel 2007
    Posts
    1

    Covert date/time to military time hour only

    Hello,

    i converted "6/1/2013 1:30:41 AM" to show as just "01" (military hour), but I am not able to do anything with it because when you click on the cell it still reads as "6/1/2013 1:30:41 AM". How can i convert the date/time to just "01" so i can sort or subtotal?

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Covert date/time to military time hour only

    Try

    =TEXT(A1,"hh")

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Covert date/time to military time hour only

    Or =hour(a1)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Covert date/time to military time hour only

    Hi and welcome to the forum

    Formatting does not change the actual contents of a cell, just the cosmetics - how it looks. If you want to change the actual contents of a cell, you usually need to apply a formula to it. Something like this, in B1 (assuming your data is in A1)...

    =TIME(HOUR(A1),0,0)
    and then format custom as hh
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Covert date/time to military time hour only

    Hi,

    What do you mean by 'converted'? Is the cell a date number like 41280 that's formatted to show just the hour. i.e. are you just formatting it rather than converting it as you say.

    Maybe in another cell...
    =(A1-INT(A1))*24
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1