Groups | Blog | Home
all groups > sql server clients > december 2004 >

sql server clients : DATETIME Default getDate() query


Steve Kass
12/19/2004 12:40:33 PM
Paul,

You can use this as your default:

Default dateadd(d,0,datediff(d,0,getdate()))

It works by finding the number of day boundaries between day 0 (January
1, 1900) and now, and adds that many days back to day 0.

Steve Kass
Drew University

[quoted text, click to view]
Paul Evans
12/19/2004 3:50:47 PM
Hi,

I have created a datagrid within an ASP.NET page that links to an SQL
table - this works just fine. One of the columns retrieves the date which a
particular row was populated. However, the format
which the date is returned is:

19.12.2004 13:03:25

I only want to display the date that the row was populated, not the exact
time as well. When I created the table I used the following code (I've cut
out the rest of the fields):

CREATE TABLE Users
(
.
.
.
.
u_entrydate DATETIME Default getDate()
)


Is this to do with the DATETIME Default getDate() code for creating the
column? Is there something else I could use to get just the date only, with
out the time of day the row was populated?

I'm using a microsoft SQL server.

Thanks for your time

Paul Evans
P.S. or is it a problem with my ASP.NET code?

AddThis Social Bookmark Button