Sunday, March 11, 2012

Convert to different date time format

Hi,
I want to convert following datetime value '2001-09-15 00:00:00.000'
to
'2001-09-15'
and the time part to be converted to respective 'AM, PM' Value
How can I do that?Better to do the formatting in the client side.
select
convert(varchar(10), getdate(), 126) + ' ' + right(convert(varchar(35),
getdate(), 109), 14)
go
AMB
"dotnettester" wrote:

> Hi,
> I want to convert following datetime value '2001-09-15 00:00:00.000'
> to
> '2001-09-15'
> and the time part to be converted to respective 'AM, PM' Value
> How can I do that?
>|||On Tue, 23 Aug 2005 13:57:01 -0700, dotnettester wrote:

>Hi,
>I want to convert following datetime value '2001-09-15 00:00:00.000'
>to
>'2001-09-15'
>and the time part to be converted to respective 'AM, PM' Value
>How can I do that?
Hi dotnettester,
http://www.karaszi.com/SQLServer/info_datetime.asp
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment