Home > Archive > MS SQL Server > October 2006 > DATE CONVERSION









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DATE CONVERSION
krallabandi@gmail.com

2006-10-24, 6:30 pm

How to convert DATE from one format to another.

datatype: datetime

original format: 2006-09-25 10:48:19.000

I need to convert to 2006-09-25

any TSQL function? I want to do this in a single SQL query. The above
date value can be NULL as well. If it is null, It should no do
anything.

Thanks.

Hari Prasad

2006-10-24, 6:30 pm

Hi,

You could use CONVERT function.

select convert(char(10),get
date(),20)

Thanks
hari
SQL Server MVP



<krallabandi@gmail.com> wrote in message
news:1158939304.788022.14330@i42g2000cwa.googlegroups.com...
> How to convert DATE from one format to another.
>
> datatype: datetime
>
> original format: 2006-09-25 10:48:19.000
>
> I need to convert to 2006-09-25
>
> any TSQL function? I want to do this in a single SQL query. The above
> date value can be NULL as well. If it is null, It should no do
> anything.
>
> Thanks.
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com