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.
Hi,
You could use CONVERT function.
select convert(char(10),getdate(),20)
Thanks
hari
SQL Server MVP
<krallabandi@.gmail.com> wrote in message
news:1158939304.788022.14330@.i42g2000cwa.googlegro ups.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.
>
Sunday, February 19, 2012
DATE CONVERSION
Labels:
000i,
2006-09-25,
2006-09-25any,
conversion,
convert,
database,
datatype,
date,
datetimeoriginal,
format,
microsoft,
mysql,
oracle,
server,
sql,
tsql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment