Time Problem in ASP. Net using an MS Access DB.

  • Thread starter Thread starter Rakesh
  • Start date Start date
R

Rakesh

Dear All,

I have used a Access DB containing a time field. I have ensured via
validation that time entered in the field is in hh:mm format. That is
working fine. The field type in Table Design mode are set to Date/Time,
Short Time.

Problem occurs when I try to display these values using a
<asp:repeater>. The displayed value contain the correct time portion
but it also contains the Date at which the entry was made. I want to
get only the time part. I am using a Jet 4.0 driver and OleDb interface
to the database.

How should I patch my query or anything to make it work?

Thanks.

Rakesh.
 
Hiya Rakesh,

Short Time is not a data type, it is merely a display format. It has no
effect on what is stored in the field, only how Access displays it. Since you
are not using Access to display the data, the Access display format is
irrelevant to you.

Ideally, you would format the value in your application. However, you can
also do it in the query, for example:

SELECT Format(some_date,"hh:mm") AS time_only FROM some_table

Be aware that the result of this will be a string, not a datetime value.
 

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

Back
Top