Extract hour from date

O

Orhan

Hello,

I want to extract the from these cells only the hour:

9/3/2007 2:25:46 AM cell value must become 02
9/3/2007 2:25:46 PM cell value must become 14

I can use date format to show only "hh", but cell value is still
"9/3/2007 2:25:46 AM"
 
O

Otto Moehrbach

Say your date and time is in A1. In some other cell enter "=Mod(A1,1)"
without the quotes, and format the cell for time. HTH Otto
 
O

Orhan

Hi,

It shows correct hour "02" but when I copy-pastevalues the cell value
is still "2:25:46 AM"
 
F

faisalmooraby.subscription

Hi Orhan

Try this:

if your date is in A1, then Hour(A1). Then format the cell as "00"

Faisal...
 
O

Otto Moehrbach

Format the cell Custom - hh. That is, click Format - Cells - Number tab -
Custom, type hh for type. HTH Otto
 
O

Otto Moehrbach

Say your date and time are in A1, as before. In another cell, type, without
quotes, "=HOUR(MOD(A1,1))"
This will get you the hour. If you pastespecial - Values this to another
cell you will get the hour only. HTH Otto
 
O

Orhan

Say your date and time are in A1, as before. In another cell, type, without
quotes, "=HOUR(MOD(A1,1))"
This will get you the hour. If you pastespecial - Values this to another

Thanks,
That did the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top