Hi,

Access doesn't have a dedicated time data/column type. You need to use the Date/Time data type which records a timestamp (Date + Time). Since you don't want or need the date information, when setting the data to store in the field, you can use any date, but you do have to specify one. It's not a big deal really, just set the date to some standard, say 1/1/1950.

For example, if you are getting the time from a form field named "mytime", then the value for an insert action might look like:

1/1/1950 <@ARG mytime>

Simple.

When pulling the time out of the database, you simply need to use a FORMAT attribute in your <@COLUMN ...> tag. For example:

<@COLUMN "myTable.myTime" FORMAT="datetime:%I:%M:%S %p">

for standard US 12 hour clock representation.


I find it much easier to handle times this way than to convert all times to seconds and store them. For one, it means I can use the database to do a full range of date/time calculations for me. For another, it means I don't have to put additional code in my application to convert dates/times into numbers (all that code is already in Access, so why should I duplicate it?).


Hope this helps.

Eric

At 09:17 AM 1/14/2004, you wrote:
Ok,

I used to know, how to do this, and I have searched the list and I can't
find it. I guess I got Mid-ziehemers.

I am trying to insert a time into an access table.
Can someone please smack me up-side-the-head ;-)

Ben Johansen - http://www.pcforge.com
Authorized Witango & MDaemon Reseller
Available for Witango Developement




________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to