Medium time text box shows year

V

vegathena

I am working with an adp access frontend and a SQL Server backend.
One of my forms uses several Medium Time fields with
Input Mask: 99:00\ >LL;0;_
Default Value: #10:00:00 PM# (for example)

The problem is that whenever I click on one of these fields the
following year information shows, too, in addition to the time:
"12/30/1899"
The year information is also saved in the SQL Server table, e.g.
"12/30/1899 10:00:00 PM"

I only want to save the time, how do I get rid of the year?

Thanks for your help.
 
D

Douglas J. Steele

AFAIK, SQL Server doesn't have a time-only data type (I know Access
doesn't...)

Since I'm more familiar with Access, I'll explain in Access terms (I believe
the situation is similar in SQL Server). The Date data type is an 8 byte
floating point number, where the integer portion represents the date as the
number of days relative to 30 Dec, 1899 (the 0 date in SQL server is
different...), and the decimal portion represents the time as a fraction of
a day. There's no way to avoid seeing the date in Access.
 
J

John W. Vinson

I only want to save the time, how do I get rid of the year?

An Access date/time value is actually stored as a number, a count of days and
fractions of a day (times) since midnight, December 30, 1899 - which is why
you're seeing that day. There is no such thing as "just a time" in a date/time
field; there is ALWAYS a date, and if you don't specify one, it's that date!

The conventions are a bit different in SQL/Server, but a Datetime or
Smalldatetime value still must contain both a date and a time. 11:30am *is*
ambiguous and not specific, since it happens every day. You must store the
date, though you can set the format with which it is displayed so the user
doesn't see it.

John W. Vinson [MVP]
 
V

vegathena

Thanks for your answers.

An Access date/time value is actually stored as a number, a count of days and
fractions of a day (times) since midnight, December 30, 1899 - which is why
you're seeing that day. There is no such thing as "just a time" in a date/time
field; there is ALWAYS a date, and if you don't specify one, it's that date!

The conventions are a bit different in SQL/Server, but a Datetime or
Smalldatetime value still must contain both a date and a time. 11:30am *is*
ambiguous and not specific, since it happens every day. You must store the
date, though you can set the format with which it is displayed so the user
doesn't see it.

John W. Vinson [MVP]
 

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

Top