PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Setup How to convert mm/dd/yyyy date format to yyyymmdd

Reply

How to convert mm/dd/yyyy date format to yyyymmdd

 
Thread Tools Rate Thread
Old 08-07-2003, 08:56 PM   #1
Jeff
Guest
 
Posts: n/a
Default How to convert mm/dd/yyyy date format to yyyymmdd


I have a cell with a custom date format of m/d/yyyy h:mm,
I need to convert the date to yyyymmdd text. Does anyone
have a VB macro code snippet to do something like this?
I've tried text to columns but can't get it to work...any
help is appreciated.

Thanks.
  Reply With Quote
Old 08-07-2003, 10:28 PM   #2
Richard Adrian
Guest
 
Posts: n/a
Default Re: How to convert mm/dd/yyyy date format to yyyymmdd

Hi Jeff,

I can help with part of this - don't know if it will give u the end solution
you want, though...

I can help u get from m/d/yyyy to yyyymmdd.

You say you already have a cell with "m/d/yyyy h:mm". Select that cell;
press Ctrl+1 to access the Format dialogue box for that cell. Select the
tab number. in the category box, select "custom". Then, in the "type" box,
type "yyyymmdd" - just that. that will automatically change your m/d/yyyy
to yyyymmdd. You can also copy this format to any other cell in that
workbook to get from m/d/yyyy to yyyymmdd.

I don't understand what you mean when you write that you want to get from
the "h:mm" part to "text". What text exactly? It is possible to have Excel
just lose the h:mm in the cell so that you go from m/d/yyyy h:mm to plain
old yyyymmdd - but what's this text u want to add?

Hope this is of some help,

Richard.

"Jeff" <jwysocki@lodan.com> wrote in message
news:0ef101c34593$5b14ba60$a001280a@phx.gbl...
> I have a cell with a custom date format of m/d/yyyy h:mm,
> I need to convert the date to yyyymmdd text. Does anyone
> have a VB macro code snippet to do something like this?
> I've tried text to columns but can't get it to work...any
> help is appreciated.
>
> Thanks.



  Reply With Quote
Old 09-07-2003, 12:48 AM   #3
Kim Mitchell
Guest
 
Posts: n/a
Default Re: How to convert mm/dd/yyyy date format to yyyymmdd

Using VBA, the command you want is:
Range("C2")=Format(Range("B2"),"yyyymmdd").

Kim

"Richard Adrian" <xxx@xxxx.com> wrote in message
news:elDQr$ZRDHA.3880@tk2msftngp13.phx.gbl...
> Hi Jeff,
>
> I can help with part of this - don't know if it will give u the end

solution
> you want, though...
>
> I can help u get from m/d/yyyy to yyyymmdd.
>
> You say you already have a cell with "m/d/yyyy h:mm". Select that cell;
> press Ctrl+1 to access the Format dialogue box for that cell. Select the
> tab number. in the category box, select "custom". Then, in the "type"

box,
> type "yyyymmdd" - just that. that will automatically change your m/d/yyyy
> to yyyymmdd. You can also copy this format to any other cell in that
> workbook to get from m/d/yyyy to yyyymmdd.
>
> I don't understand what you mean when you write that you want to get from
> the "h:mm" part to "text". What text exactly? It is possible to have

Excel
> just lose the h:mm in the cell so that you go from m/d/yyyy h:mm to plain
> old yyyymmdd - but what's this text u want to add?
>
> Hope this is of some help,
>
> Richard.
>
> "Jeff" <jwysocki@lodan.com> wrote in message
> news:0ef101c34593$5b14ba60$a001280a@phx.gbl...
> > I have a cell with a custom date format of m/d/yyyy h:mm,
> > I need to convert the date to yyyymmdd text. Does anyone
> > have a VB macro code snippet to do something like this?
> > I've tried text to columns but can't get it to work...any
> > help is appreciated.
> >
> > Thanks.

>
>



  Reply With Quote
Old 10-07-2003, 12:29 PM   #4
Ian
Guest
 
Posts: n/a
Default How to convert mm/dd/yyyy date format to yyyymmdd

Can you not just format the cell using Custom format
(Format>Cells>Custom Format) and type yyyymmdd ?


>-----Original Message-----
>I have a cell with a custom date format of m/d/yyyy h:mm,
>I need to convert the date to yyyymmdd text. Does anyone
>have a VB macro code snippet to do something like this?
>I've tried text to columns but can't get it to work...any
>help is appreciated.
>
>Thanks.
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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

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