Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to convert nvarchar date to date time

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2009-06-04 : 11:42:33
Hi All,

I have a tabel called Promo
It has the following two fields.
StartDate
RevertDate


Both arer date fields but are in yyyy/mm/dd format. In my select how to convert them into datetime datatype with a yyyy-mm-dd format.

Please suggest.

Thanks,

Zee

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-04 : 11:44:13
[code]
select StartDate = convert(datetime, StartDate, 121), RevertDate = convert(datetime, RevertDate, 121)
from Promo
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2009-06-04 : 12:07:18
Khtan - It worked. Thanks... :)
Go to Top of Page
   

- Advertisement -