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
 General SQL Server Forums
 New to SQL Server Programming
 Now() Date

Author  Topic 

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2010-07-27 : 05:55:20
Hi,

I want to have a Date read only rather than the time. When I have
NOW() - it brings the date and time.

I would want to have a date only. For example instead of 27/07/10 10:32:19

I would like to show 27/07/10, any help please

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-27 : 06:02:20
NOW() ? or do you mean getdate() ?

Is this Microsoft SQL Server ?


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

Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2010-07-27 : 06:04:16
Yes it is Microsoft Sql server 2005, I have , { fn NOW() } which I want to shorten and bring only dd/mm/yy, without the time.

In Vb.Net its like - Now.ToShortDateString()

Any help please
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-07-27 : 06:09:29
select convert(varchar(10),getdate(),101)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-28 : 06:21:33
select { fn current_date() }

For more informations, refer this
http://beyondrelational.com/blogs/madhivanan/archive/2007/11/01/undocumented-date-and-time-related-functions.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -