Friday, February 10, 2012

convert date to MMDDYYYY

Hello All,

I can't seem to find an answer to this anywhere else: I need to
convert a datestamp to the following format: MMDDYYYY. I've found
solutions to convert it to many different kids of formats, but not one
that allows me to enter the positions of the month, day and year.
Anyone have any ideas?

Thanks,

Mike<mscgloss@.yahoo.com> wrote in message
news:1095699247.330433.190810@.k26g2000oda.googlegr oups.com...
> Hello All,
> I can't seem to find an answer to this anywhere else: I need to
> convert a datestamp to the following format: MMDDYYYY. I've found
> solutions to convert it to many different kids of formats, but not one
> that allows me to enter the positions of the month, day and year.
> Anyone have any ideas?
> Thanks,
> Mike

Here's one way:

select replace(convert(char(10), getdate(), 101), '/', '')

Alternatively, you could format it in your client application if that makes
sense in your environment.

Simon

No comments:

Post a Comment