View Full Version : Date/Time field problem


CraigBFG
07-26-2004, 08:14 AM
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

Mile-O
07-26-2004, 08:31 AM
You can either stop using Now() and just use Date() or use the DateValue() function.

CraigBFG
07-26-2004, 08:33 AM
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

Mile-O
07-26-2004, 08:35 AM
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. :)

CraigBFG
07-26-2004, 08:40 AM
That worked perfectly - cheers!