+ Reply to Thread
Results 1 to 7 of 7

convert a text date into a proper date

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154

    convert a text date into a proper date

    I have a column of dates in thie format " January 5 03:09:36 2009" which i need to convert into a proper excel date that i can do further calculations on (adding up things, graphs etc based on dates).

    Note the space before the month name. I thought about doing a left(cell,xx) to get it but that isnt going to work with the space infront and the variable length of month names.

    I do not necessarily need the time included, it may be useful at some point if its easy to keep it as part of the data, if not i can live without it.

    Thanks
    Last edited by neowok; 01-09-2009 at 07:48 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Are you in the US? If your default date format is m/d/yy then, assuming your timestamp in A1 you can extract the date with this formula in B1

    =MID(REPLACE(A1,LEN(A1)-13,9,","),2,99)+0

    Format B1 as a date

    If you want to include the time, too try

    =MID(REPLACE(A1,LEN(A1)-13,0,", "&RIGHT(A1,4)),2,LEN(A1))+0

    and format as date and time

  3. #3
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154
    Thanks

    I am in UK so d/m/y

    tried those anyway but got #value error, it didnt seem to like the +0 at the end, taking it off seems to show the date but leaves it as text still
    Last edited by neowok; 01-09-2009 at 07:15 PM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    try
    =VALUE(A1)
    edit oops to quick sorry
    that returns 1 jan 05

  5. #5
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154
    nup dont work, comes up as 1st jan 2005

    i think the solution above will work, i just need to figure out how to move the day to the left of the month in the formula to UK format and then i guess itll work

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    For UK settings try like this for the date

    =REPLACE(REPLACE(A1,FIND(":",A1)-2,9,MID(A1,2,FIND(" ",A1,2)-1)),1,FIND(" ",A1,2),"")+0

    and for date and time

    =REPLACE(REPLACE(A1,FIND(":",A1)-2,9,MID(A1,2,FIND(" ",A1,2)-1)),1,FIND(" ",A1,2),"")+LEFT(RIGHT(A1,13),8)

    If you want date in one cell annd time in another then use the first one for the date and

    =LEFT(RIGHT(A1,13),8)+0

    for the time

  7. #7
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154
    thanks that worked

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1