Datetime confusion (1 Viewer)

jaytheguru

Registered User.
Local time
Today, 00:01
Joined
Nov 13, 2007
Messages
43
Morning all, I am a new user to access database so you got to bear with me.

I have created a table in Access 2003 where I have defined a field "Time In", this field should contain only time and not date.

I setup the format of the field into Long Time and setup the mask as hhnnss (checked on microsoft website).

When I open the table (in normal mode) it shows only time which is fine, however when I use the same feature in VB.Net (Datagrid view) it shows date and time where date=30/12/1899 and time=current time.

I have looked all over the internet to find out how to get rid of that date from my field but couldn't find anything.

I have read on MS site that the base date in the datetime field is 30/12/1899 however, how can we take this field out.

In summary:

How can I get rid of this date feature and can have only time which will then reflect in my vb application.

many thanks

Regards

j
 

DCrake

Remembered
Local time
Today, 00:01
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

Not a .Net user, however I sugest it will be a format issue. In Access you can set it to be Long Date. If you are not using this time for calculations I would suggest you save it as text string instead of a date time. If you are using it for calculations then it may be better to save it as a number. If you are using hh:nn format then convert the time to minutes past midnight, for hh:nn:ss use seconds past midnight.

Alternatively

Store the time in a number field and convert the actual time to double, such as:

LogTime = CDbl(TimeOfDay)

Then to convert it back to a time

use Format(LogTime,"Long Time")
 

jaytheguru

Registered User.
Local time
Today, 00:01
Joined
Nov 13, 2007
Messages
43
Thanks for the quick and informative response.

I did use it as a string and it is working now.

Many thanks

Kind regards

J
 

Users who are viewing this thread

Top Bottom