Microsoft Office Forums


Reply
Thread Tools Display Modes

convert date from string to date format

 
 
Howard - JC Publishing
Guest
Posts: n/a

 
      04-09-2008, 04:11 PM
I am importing data from our database into Excel. The database program
stores dates as a string such as 20080124. I want to convert that string the
mm/dd/yyyy.

Thank you.


 
Reply With Quote
 
 
 
 
timmg
Guest
Posts: n/a

 
      04-09-2008, 04:30 PM
On Apr 9, 11:11*am, Howard - JC Publishing
<HowardJCPublish...@discussions.microsoft.com> wrote:
> I am importing data from our database into Excel. *The database program
> stores dates as a string such as 20080124. *I want to convert that string the
> mm/dd/yyyy.
>
> Thank you.


Assuming the value in A1 the formulae:

=MID(A1,5,2)&"/"&RIGHT(A1,2) &"/" &LEFT(A1,4) will produce a text
value

and

=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)) will produce a date that can
be formatted to what you want
 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a

 
      04-09-2008, 05:03 PM
On Wed, 9 Apr 2008 09:11:03 -0700, Howard - JC Publishing
<(E-Mail Removed)> wrote:

>I am importing data from our database into Excel. The database program
>stores dates as a string such as 20080124. I want to convert that string the
>mm/dd/yyyy.
>
>Thank you.
>


First convert it to a real Excel date:

=DATE(INT(A1/10^4),MOD(INT(A1/10^2),100),MOD(A1,100))

Then, either format the cell as you wish, or use the TEXT function:

=TEXT(DATE(INT(A1/10^4),MOD(INT(A1/10^2),100),MOD(A1,100)),"mm/dd/yyyy")

--ron
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a

 
      04-09-2008, 07:20 PM
Data>Text to columns>Next>Next>Column Data Format>Date>YMD and Finish


Gord Dibben MS Excel MVP

On Wed, 9 Apr 2008 09:11:03 -0700, Howard - JC Publishing
<(E-Mail Removed)> wrote:

>I am importing data from our database into Excel. The database program
>stores dates as a string such as 20080124. I want to convert that string the
>mm/dd/yyyy.
>
>Thank you.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert date to string? Emjaysea Access Newsgroup 6 10-10-2007 08:08 PM
Excel date format convert to string format man Excel Newsgroup 1 08-17-2006 09:00 AM
Convert Julian (Date) to Short Date Format SKB Access Newsgroup 2 09-20-2005 03:55 PM
Converting string reprentation of date to Date format underhill Excel Newsgroup 3 01-12-2004 02:13 AM
How to convert Excel serial date into Access date format? RADO Access Newsgroup 2 12-27-2003 11:14 AM



All times are GMT. The time now is 02:23 PM.