Date Problem

AndyShuter

Registered User.
Local time
Today, 23:05
Joined
Mar 3, 2003
Messages
151
After performing a date calculationI keep getting the following format even though I have set the format property & the input mask to short date on the table and the form!

09/08/2004 18:00:00

I think the problem arises as I am sometimes prforming a calculation with a decimal place in such as MyControl = Date()-4.4 etc

I need to keep the decimal place for other calcs



Is there a way in VB of setting the control to just return 09/08/2004

Thanx

Andy
 
It could be 4.4 days
 
I suppose this calculation resulting in time 18:00, includes 0.25?

A date is just a number, where the integer part represents days since 1900 (or day one is 31/12/1899), and the fractions represents seconds since midnight. Try the following in the immediate pane (ctrl+g) and hit enter on each line:

? format(date, "mm/dd/yyyy hh:nn:ss")
? format(date-0.5, "mm/dd/yyyy hh:nn:ss")
? format(date-0.25, "mm/dd/yyyy hh:nn:ss")

Todayas date, without a time part (without fractions) where 0.4 is subtracted, should become:

? format(date-0.25, "mm/dd/yyyy hh:nn:ss") -> 08/01/2005 14:24:00

I suppose, to retrieve only the date, you could try the Fix function

? format(fix(date-0.25), "mm/dd/yyyy hh:nn:ss") -> 08/01/2005 00:00:00

Remember that formatting a field or a control, is just about how to view the information, not how it is stored. If you store date and time (as you do when assigning fractions), that's the contents, regardless of whats showed.
 

Users who are viewing this thread

Back
Top Bottom