The same Date / Time field contains time in different format after import from text file

E

Evgeniy

Hi all!

I imported very simple text file, which contain two times delimited by semicolon, just like

09:58;17:18

10:10;18:27

10:23;19:23

The type of Access fields are Date/Time formatted as Short Time, having input mask "00:00;0;_".

I opened the table after import and all the values are were shown in the right format "HH:mm", exactly the same as in the text file. But when I wanted to edit these fields, some of them showed values in the same format, but some added seconds "HH:mm:ss". Access did not let to change the figures in such fields, saying "The value you entered isn't appropriate for the input mask '00:00;0;_' specifies for this field". After deleting seconds changing figures is allowed.

I could not find the rule, which time values will be imported in the format specified and which will add seconds.

The second and following imports of the same file will have just the same effect. Exactly the same values will be imported with the seconds added. Moreover the same effect is reproduced on different computers with different OS installed and using different Access versions (I tried it on Access 95 and on Access XP).

Thank you in advance.

Evgeniy.
 
J

John W. Vinson

Hi all!

I imported very simple text file, which contain two times delimited by semicolon, just like

09:58;17:18

10:10;18:27

10:23;19:23

The type of Access fields are Date/Time formatted as Short Time, having input mask "00:00;0;_".

I opened the table after import and all the values are were shown in the right format "HH:mm", exactly the same as in the text file. But when I wanted to edit these fields, some of them showed values in the same format, but some added seconds "HH:mm:ss". Access did not let to change the figures in such fields, saying "The value you entered isn't appropriate for the input mask '00:00;0;_' specifies for this field". After deleting seconds changing figures is allowed.

I could not find the rule, which time values will be imported in the format specified and which will add seconds.

The second and following imports of the same file will have just the same effect. Exactly the same values will be imported with the seconds added. Moreover the same effect is reproduced on different computers with different OS installed and using different Access versions (I tried it on Access 95 and on Access XP).

Thank you in advance.

Evgeniy.

First off, date/time fields do NOT have a stored format. A Date/Time value is
stored as a double float number, a count of days and fractions of a day since
midnight, December 30, 1899. For instance, 18:00 is actually stored as 0.75,
and corresponds to a specific point in time - 6PM on December 30, 1899.

The format is applied when the value in the field is displayed. It's not
stored in the field. 0.75 can be displayed as "18:00:00" or "6:00PM" or even
as "12 December 1899, 18 hours and 00 minutes", even all at the same time in
different controls. When you go to *EDIT* a date/time value you'll see the
entire value (with the seconds, always as 00) because that's what's actually
there.

You're not able to type into the field because the input mask is constraining
what you can type. Since you're importing the data, not typing it, I'd simply
remove the input mask and use a Format property of hh:nn (rather than Short
Time).
 
E

Evgeniy

Thank you, John.

But it is not clear why some of the values are imported in such case, that
they display seconds, but some not.

And I could not use a Format property of hh:nn - after entering hh:nn into
the property and changing focus its value becomes Short Time again.

Thank you.

Evgeniy.
 
J

John W. Vinson

But it is not clear why some of the values are imported in such case, that
they display seconds, but some not.

Are these nonzero seconds? or :00?
And I could not use a Format property of hh:nn - after entering hh:nn into
the property and changing focus its value becomes Short Time again.

<blush> My mistake. "Short Time" and "hh:nn" are just two names for the same
format value (at least in your, and my, regional setting).
 
E

Evgeniy

They are :00

John W. Vinson said:
Are these nonzero seconds? or :00?


<blush> My mistake. "Short Time" and "hh:nn" are just two names for the
same
format value (at least in your, and my, regional setting).
 

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