#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date format

I have dates like the following:

Apr142003 12:56AM
Jan 12 2003 10:53AM
Feb 14 2004 11:43AM
Apr 21 2003 10:53AM
*Note there is only one space between the fields*
Also on the same column are dates like this
Jul 4 2005 1:18AM (between jul and 4 are 2 spaces and between 2004 and
time is 2 spaces. 2 spaces occur when the number is only 1 digit in size but
looses the second space when the number is 2 digits in size). I've looked at
all the formatting formulas but nothing there for it. Unfortunately I can't
change it at source. Any programming ideas out there that I should persue?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Date format

Hi,

Assuming dates are enterred as
mmmx[x/d]dxyyyyx[x/h]h:mmPP
with
- x representing a space
- [x/d] or [x/h] meaning either a space or a single digit
- PP being either AM or PM

Say your date is in a1.
B1: =MID(A1,5,2)&"-"&LEFT(A1,3)&"-"&MID(A1,8,4)&" "&MID(A1,13,5)&"
"&RIGHT(A1,2)
-- returns the date properly for next step, formatted as Text.
C1: =DATEVALUE(B1) + TIMEVALUE(B1)
-- Returns date-time as number. Format the Cell as date.
--
Regards,
Sébastien


"Rory Carroll" wrote:

I have dates like the following:

Apr142003 12:56AM
Jan 12 2003 10:53AM
Feb 14 2004 11:43AM
Apr 21 2003 10:53AM
*Note there is only one space between the fields*
Also on the same column are dates like this
Jul 4 2005 1:18AM (between jul and 4 are 2 spaces and between 2004 and
time is 2 spaces. 2 spaces occur when the number is only 1 digit in size but
looses the second space when the number is 2 digits in size). I've looked at
all the formatting formulas but nothing there for it. Unfortunately I can't
change it at source. Any programming ideas out there that I should persue?

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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Convert european foreign date format to US date format EAL Excel Worksheet Functions 1 May 14th 09 10:02 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


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