Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cut time from string ?


I have a date/time in the form of:

12/24/2006 4:21:49 AM

I want only 12/24/2006.

How do I get rid of 4:21:49 AM ?


Formating *shows* only 12/24/2006
but the time is still part of the data.

If I try:

ActiveCell.Formula = Left(ActiveCell.Formula, 10)
or
ActiveCell.Formula = Mid(ActiveCell.Formula, 1, 10)

the string is not shortened
but the number of seconds seems to diminish.

Thank you,
Emory
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Cut time from string ?

XL stores date/times as integer and fractional offsets from a base date.


Try entering this in the immediate window:

?CDbl(Date), CDbl(Time), CDbl(Now)

So

ActiveCell.Value = Int(ActiveCell.Value)

will get rid of the time portion.


In article ,
Emory Richter wrote:

I have a date/time in the form of:

12/24/2006 4:21:49 AM

I want only 12/24/2006.

How do I get rid of 4:21:49 AM ?


Formating *shows* only 12/24/2006
but the time is still part of the data.

If I try:

ActiveCell.Formula = Left(ActiveCell.Formula, 10)
or
ActiveCell.Formula = Mid(ActiveCell.Formula, 1, 10)

the string is not shortened
but the number of seconds seems to diminish.

Thank you,
Emory

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Cut time from string ?

ActiveCell = DateValue(ActiveCell)

Hth,
Merjet


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Cut time from string ?

In article . com,
says...
Merjet


Merjet
Thank you for your answer.
Emory
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Special string convertion to date and time c stinz Excel Worksheet Functions 5 February 3rd 12 01:45 PM
convert string to date & time [email protected] Excel Worksheet Functions 4 October 30th 06 04:26 PM
Converting text string to a its proper time format Edmund Wong Excel Discussion (Misc queries) 3 October 21st 05 12:37 AM
Function to convert Time String to Time Andibevan Excel Worksheet Functions 6 August 19th 05 01:19 PM
Date/Time - String or Number! RzB Excel Programming 4 October 27th 03 08:44 PM


All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"