December 1, 2009 at 6:09 am
How can I obtain a date part of the function getdate ? or any datetime value.
For Example:
If i have a value: "30/11/2009 12:32:33", I need to obtain the result: 30/11/2009
Thanks
December 1, 2009 at 6:14 am
Select convert(varchar(10), getdate(), 103)
---------------------------------------------------------------------------------
December 1, 2009 at 7:03 am
Thanks for ansuwer me.
And If I need to obtain the time of the getdate ?
How can I do that?
December 1, 2009 at 7:13 am
You could try looking up CONVERT in BOL (Books Online).
select convert(varchar(10), getdate(), 108)
December 1, 2009 at 7:16 am
Easy and it depends in what format you want. For the format you've shown try this,
Select RIGHT(convert(varchar(20), getdate(), 120), 8)
Edit:Just saw Lynn's post. Thats elegant take that.
---------------------------------------------------------------------------------
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply