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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Eliminating the time with smalldatetime field 2

Status
Not open for further replies.

Sydney1

Technical User
Jul 14, 2004
156
US
Hi,

I'm using the smalldatetime data type. When I automatically add it to the field, using (getdate()) in the field's default value or inserting it by code, the time also is inserted. However, when the date is inserted manually (in another smalldatetime field) the time is not included. Is there any way to not include the time by using getdate, or by code, which is VBA and may not be relevant to this forum.

Thanks in advance for your help.

Sydney
 
To use getdate() without the time simply
Code:
convert(varchar,getdate(),101)
This would take the datetime 2005-01-20 07:55:58.933 and make it 01/20/2005

 
Deja vu... for the 89th time :(
Code:
select dateadd(dd, 0, datediff(dd, 0, getDate()))
 
Thanks for the help, that worked great. I'll give the code part a shot, but again it might not be appropriate for this forum. If so, my apologies. I have the following code
Code:
MyTable("ScheduleDate") = DateAdd("D", 3, Forms!frmLitigationEntry![txtstartDate])
ScheduleDate is smalldatetime and I'm trying to get rid of the time. Any suggestions would be greatly appreciated.

Thanks again.

Sydney
 
Hi,

Thanks for the help. Its VBA. I've tried to add it to the line of code but to no avail. How would I add it to the above line of code?

Thank you so very much.

Sydney
 
VBA Visual Basic for Applications (Microsoft) Forum
(34015 members)
forum707
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top