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.
>
Showing posts with label datetimeoriginal. Show all posts
Showing posts with label datetimeoriginal. Show all posts
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
Friday, February 17, 2012
DATE CONVERSION
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.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.
>
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.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.
>
Labels:
000i,
2006-09-25,
2006-09-25any,
conversion,
convert,
database,
datatype,
date,
datetimeoriginal,
format,
microsoft,
mysql,
oracle,
server,
sql,
tsql
Subscribe to:
Posts (Atom)