Date/Time field problem

CraigBFG

Registered User.
Local time
Today, 20:59
Joined
Aug 21, 2003
Messages
68
I've got a small problem with a calculation on an ASP form, and I've tied it down to the date field in the db.

Basically, because this certain field records date & time, the calculations are off slightly.

Is there any way that I can strip out/delete the TIME data from the date/time field?

eg
26/06/2004 13:15:38 ... and all I need is ... 26/06/2004

Any ideas guys & gals?

Thanks
 
You can either stop using Now() and just use Date() or use the DateValue() function.
 
Thanks for that.
That's great for the future, but I really need to remove the time element from the existing data.

Is there anyway that I can achieve this, maybe with an update query or something fancy?

Thanks
 
UPDATE MyTable SET MyField = DateValue(MyField);

DateValue might, I think, return a string, so the CDate() function may be handy.

UPDATE MyTable SET MyField = CDate(DateValue(MyField));


Remember to make a copy of the table and test the query on that first. :)
 

Users who are viewing this thread

Back
Top Bottom