Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a date string of 2/21/2005 1:07:22 PM. When I convert it to Long I
get a value of 38405, which is 2/22/2005. How can I make the value be 2/21/2005? Can I truncate the date string to remove the time part? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
jerry,
Use a Double instead of a Long. Regards, Jim Cone San Francisco, USA "jerry chapman" wrote in message om... I have a date string of 2/21/2005 1:07:22 PM. When I convert it to Long I get a value of 38405, which is 2/22/2005. How can I make the value be 2/21/2005? Can I truncate the date string to remove the time part? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sStr = "2/21/2005 1:07:22 PM"
v = int(cdate(sStr)) ? v 02/21/2005 you could dim v as Long -- Regards, Tom Ogilvy "jerry chapman" wrote in message om... I have a date string of 2/21/2005 1:07:22 PM. When I convert it to Long I get a value of 38405, which is 2/22/2005. How can I make the value be 2/21/2005? Can I truncate the date string to remove the time part? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I define a cell as date & time?
"Tom Ogilvy" wrote in message ... sStr = "2/21/2005 1:07:22 PM" v = int(cdate(sStr)) ? v 02/21/2005 you could dim v as Long -- Regards, Tom Ogilvy "jerry chapman" wrote in message om... I have a date string of 2/21/2005 1:07:22 PM. When I convert it to Long I get a value of 38405, which is 2/22/2005. How can I make the value be 2/21/2005? Can I truncate the date string to remove the time part? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
activecell.numberformat = "mm/dd/yyyy hh:mm:ss"
or put a date value in it Sub CCC() Dim dt As Date dt = DateSerial(2005, 2, 21) + TimeSerial(10, 30, 0) ActiveCell.Value = dt ActiveCell.EntireColumn.AutoFit End Sub -- Regards, Tom Ogilvy "jerry chapman" wrote in message om... How can I define a cell as date & time? "Tom Ogilvy" wrote in message ... sStr = "2/21/2005 1:07:22 PM" v = int(cdate(sStr)) ? v 02/21/2005 you could dim v as Long -- Regards, Tom Ogilvy "jerry chapman" wrote in message om... I have a date string of 2/21/2005 1:07:22 PM. When I convert it to Long I get a value of 38405, which is 2/22/2005. How can I make the value be 2/21/2005? Can I truncate the date string to remove the time part? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Long Date - Long Date = text is days | Excel Discussion (Misc queries) | |||
search for date in long string of text | Excel Discussion (Misc queries) | |||
Long string of IF formulas | Excel Discussion (Misc queries) | |||
Transposing a Long String | Excel Worksheet Functions | |||
converting a string to long | Excel Programming |