ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract hour from date (https://www.excelbanter.com/excel-programming/400104-extract-hour-date.html)

Orhan

Extract hour from date
 
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"


Otto Moehrbach

Extract hour from date
 
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
"Orhan" wrote in message
ups.com...
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"




Orhan

Extract hour from date
 
Hi,

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


[email protected]

Extract hour from date
 
Hi Orhan

Try this:

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

Faisal...
On 26 Oct, 21:35, Orhan wrote:
Hi,

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



Otto Moehrbach

Extract hour from date
 
Format the cell Custom - hh. That is, click Format - Cells - Number tab -
Custom, type hh for type. HTH Otto
"Orhan" wrote in message
ups.com...
Hi,

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




Otto Moehrbach

Extract hour from date
 
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
"Orhan" wrote in message
ups.com...
Hi,

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




Orhan

Extract hour from date
 
On Oct 27, 12:06 am, "Otto Moehrbach" wrote:
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"Orhan" wrote in message

ups.com...

Hi,


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


Thanks,
That did the trick.



All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com