How to extract Hours from the date time format 12/10/2012 12:18:58 PM?

date, excel, format, vba

Solution

This should work

=TEXT(D1, "hh")

and format as time

Problem

How do I extract the hours from the date time format `12/10/2012 12:18:58 PM`? I found this `Hour(Format(d1, "mm/dd/yyyy HH:mm:ss HH24"))` on another Stack Overflow question, but not working for me.

Original source