Trouble storing Time 
Author Message
 Trouble storing Time

I am importing a time value from a text file. The value being imported
is "1650" refering to 4:50 PM. I am having trouble storing this time in
a table without the table converting it to a wierd date such as 07\07
\1904 1:04AM. The table field is set for date/time and the format is
set to "medium time". Is there a way to store just the time in the
table and not the whole date?

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Mon, 24 Dec 2001 03:00:00 GMT  
 Trouble storing Time
you may have to format it:

left(1650,2) & ":" & right(1650,2)


Quote:
> I am importing a time value from a text file. The value being imported
> is "1650" refering to 4:50 PM. I am having trouble storing this time in
> a table without the table converting it to a wierd date such as 07\07
> \1904 1:04AM. The table field is set for date/time and the format is
> set to "medium time". Is there a way to store just the time in the
> table and not the whole date?

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Mon, 24 Dec 2001 03:00:00 GMT  
 Trouble storing Time
I tried to format it with the colon (ie 16:50) but access still
converts that into some wierd date like "07/07/1904 1:04pm"



Quote:
> you may have to format it:

> left(1650,2) & ":" & right(1650,2)



> > I am importing a time value from a text file. The value being
imported
> > is "1650" refering to 4:50 PM. I am having trouble storing this
time in
> > a table without the table converting it to a wierd date such as 07
\07
> > \1904 1:04AM. The table field is set for date/time and the format is
> > set to "medium time". Is there a way to store just the time in the
> > table and not the whole date?

> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Mon, 24 Dec 2001 03:00:00 GMT  
 Trouble storing Time
Access stores Date/Times with the date as the integer portion and the time
as the decimal portion of a number. What you see on the screen is a just a
format of this number.

So the concept of storing "just the time" means using a date of 0 which is a
real date: Dec 30, 1899 (or thereabouts.)

This should give: 7/8/99 4:50:00 PM
Date() + CVDate(left(1650,2) & ":" & right(1650,2))

I just checked it in the debug window and it does work.
--
HTH
Joe
Check out Dev Ashish's web site for answers to common questions
http://home.att.net/~dashish/


Quote:
> I tried to format it with the colon (ie 16:50) but access still
> converts that into some wierd date like "07/07/1904 1:04pm"



> > you may have to format it:

> > left(1650,2) & ":" & right(1650,2)



> > > I am importing a time value from a text file. The value being
> imported
> > > is "1650" refering to 4:50 PM. I am having trouble storing this
> time in
> > > a table without the table converting it to a wierd date such as 07
> \07
> > > \1904 1:04AM. The table field is set for date/time and the format is
> > > set to "medium time". Is there a way to store just the time in the
> > > table and not the whole date?

> > > Sent via Deja.com http://www.deja.com/
> > > Share what you know. Learn what you don't.

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Mon, 24 Dec 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Trouble storing Time

2. ADO with Access Date/Time field not storing the time, just the date

3. Having trouble learning how to call stored procedures.

4. Crystal 8.5 - troubles with passing strings as stored procedure parameters

5. Trouble with stored procedures in data environment

6. Stored procedure parameter trouble

7. Trouble populating recordset from stored procedure in VB

8. Trouble passing parameters to a stored procedure in ADO

9. First time callback trouble

10. trouble with converting and adding times

11. trouble inserting date and time

12. Have troubles with a Date/Time field in access

 

 
Powered by phpBB® Forum Software