Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default date formatting

Hi ,
I got a string like "20030101" and I want this to become the date 01 jan 03 . I can't figure it out. Can you please help if this action is possible

Cheers,
Douvid
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default date formatting

One way:

Select your date string(s). Choose Data/Text to Columns. Click Next,
Next. Select YMD in the date dropdown. Click Finish. Format as a
date.


Note: Your example is ambigouous, so you may need to use YDM instead.

In article ,
douvid wrote:

Hi ,
I got a string like "20030101" and I want this to become the date 01 jan 03 .
I can't figure it out. Can you please help if this action is possible

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default date formatting

ok but I'm want to do all that from vba. through coding
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default date formatting

Turn on the macro recorder and do it manually. (for Text to columns)

If you are talking about parsing a string (assuming string is yyyymmdd)

Dim dt as Date
Dim sStr as String
sStr = "20030101"
dt = DateValue(Mid(sStr,5,2) & "/" & mid(sStr,7,2) & "/" & Left(sStr,4))

Demo'd from the immediate window:
sStr = "20030101"
? DateValue(Mid(sStr,5,2) & "/" & mid(sStr,7,2) & "/" & Left(sStr,4))
1/1/03

--
Regards,
Tom Ogilvy


douvid wrote in message
...
ok but I'm want to do all that from vba. through coding



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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
Date Formatting Mike H Excel Discussion (Misc queries) 1 May 27th 10 10:22 PM
Date Formatting TheRiverT Excel Discussion (Misc queries) 4 August 7th 09 08:46 PM
Date Formatting Des1313 Excel Discussion (Misc queries) 1 March 13th 07 09:23 PM
date formatting BernieH Excel Discussion (Misc queries) 2 May 30th 05 03:33 PM


All times are GMT +1. The time now is 10:48 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"