Date/Time problem please help !

G

Guest

Hi all,

In one of my tables there is a field defined as date/time. When I add a
record for example 07-12-2004 12:15:00 this is ok.
but when I add a record with 07-12-2004 00:00:00 it goes wrong. The only
thing that after input that is displayed is 07-12-2004.

Why doe Acces trows away the time when it is 00:00:00 and can I do something
about it ?

Please advise,

Thanks a lot in advance,

Bart Janisse
 
N

Nikos Yannacopoulos

Bart,

A date/time field in Access is in essence a numeric field which is
diplayed in a certain format by default. The integer part of the number
is the date, 0 being 12/31/1899 (today is 38,337), and the decimal part
is the time (1 being 24 hours, 0.5 being 12 hours etc). So, when you
enter a date with time 00:00:00, you are essenstially entering an
integer numeric value. Then Access doesn't find a time part so it
doesn't display one, much like it wouldn't display a decimal part if one
wasn't stored in a numeric field with no format imposed.
If you want to always display the hour, all you need to do is set the
format of the field to:
"mm-dd-yyyy hh:nn:ss"

HTH,
Nikos
 
J

Jeff Boyce

This may not be relevant, but what "time" is 00:00:00? That seems more like
a "duration" than a "point in time".

Jeff Boyce
<Access MVP>
 
G

Guest

Hi Jeff,
This may not be relevant, but what "time" is 00:00:00? That seems more like
a "duration" than a "point in time".

Thanks for your response. This may be a stupid question but how do you
specify the time at midnight in a 24 hour format ?

I think that after 23:59:59 comes the next day 00:00:00

Bart
 
A

Allen Browne

Access stores the date/time value as a fractional number, where the whole
number represents the date, and the time is the fraction of a day (.5 =
noon; .25 = 6am, ...) It is therefore not losing the time - just not
displaying it. Just as the number:
22
is exactly the same as:
22.000
so the 07-12-2004 is exactly the same as 07-12-2004 00:00:00

If you want Access to display the time anyway, use the Format property of
the field in the table, or the Format property of the text box on your form.
Set it to something like this:
dd\-mm\-yyyy hh:nn:ss
in whatever display format you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top