Format (,"medium time") ; Bug? 
Author Message
 Format (,"medium time") ; Bug?

The default value for a field is set to
#8:00:00 am# and its Format is Medium Time.

I try to put that value (through code) into
the table/field as (this is NOT the exact code:
     recordset("TimeSLot") = fldto.defaultvalue

I can't do it because the DefaultValue("TimeSlot") is
holding the garbage value #12/30/1899 8:0:0#

If I try a format statement, it still doesnt work
?format(fldto.DefaultValue,"medium time")
#12/30/1899 8:0:0#

Why can't I get simply #08:00:00 am#?



Mon, 05 Dec 2005 22:15:25 GMT  
 Format (,"medium time") ; Bug?
Internally, the Date/Time field in Access is stored as a number, where the
whole number represents the number of days since December 30, 1899, and the
fractional part represents the part of a day (0.5 is midday--half a day;
0.25 is 6am--quarter of a day, etc.)

The value 8AM is therefore one-third of a day after 12/30/1899. You can
*display* the value as a Medium Time, but it's still that value internally.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")


Quote:
> The default value for a field is set to
> #8:00:00 am# and its Format is Medium Time.

> I try to put that value (through code) into
> the table/field as (this is NOT the exact code:
>      recordset("TimeSLot") = fldto.defaultvalue

> I can't do it because the DefaultValue("TimeSlot") is
> holding the garbage value #12/30/1899 8:0:0#

> If I try a format statement, it still doesnt work
> ?format(fldto.DefaultValue,"medium time")
> #12/30/1899 8:0:0#

> Why can't I get simply #08:00:00 am#?



Mon, 05 Dec 2005 22:56:35 GMT  
 Format (,"medium time") ; Bug?

Quote:

>The default value for a field is set to
>#8:00:00 am# and its Format is Medium Time.

>I try to put that value (through code) into
>the table/field as (this is NOT the exact code:
>     recordset("TimeSLot") = fldto.defaultvalue

>I can't do it because the DefaultValue("TimeSlot") is
>holding the garbage value #12/30/1899 8:0:0#

>If I try a format statement, it still doesnt work
>?format(fldto.DefaultValue,"medium time")
>#12/30/1899 8:0:0#

>Why can't I get simply #08:00:00 am#?

Try using a custom format:
        Format(fldto.DefaultValue,"\#hh:nn:ss am/pm\#")

See Format Property in Help for a description of the
available formatting codes.

--
Marsh
MVP [MS Access]



Mon, 05 Dec 2005 23:04:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Format function with "Short Time" parameter

2. Media Player "Jumps"

3. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

4. Strange "bug?" in VS

5. Bound ComboBox "Bug"?

6. VB Script "bug"???

7. RemoteDataControl .EditMode "bug"

8. FileSystemObject.DateCreated "bug"?

9. Possible "bug" with 6.0 and LenB

10. Visual Basic bugs (exsqueeze me, "issues")

11. RemoteDataControl .EditMode "bug"

12. VB 4.0 Bugs "enhancements"

 

 
Powered by phpBB® Forum Software