Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Date field to current date (no time) 1

Status
Not open for further replies.

firsttube

Technical User
Apr 21, 2004
165
CA
I have a date field that I want to default to the date when a record is added. But getDate() inputs the date and time. Is there a way to set the default value of the field to just the date component i.e. 10/13/06 ??

thanks


Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
You can strip the time off a date field with this code...

[tt][blue]select DateAdd(Day, DateDiff(Day, 0, GetDate()), 0)[/blue][/tt]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I should mention that the time component will still exist, but it will be set to midnight. I presume that you want to remove the time component so that certain queries will be easier. If so, then follow the advice in my previous post.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top