Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set hours to 12|24
Message
De
12/09/2011 18:58:57
 
 
À
12/09/2011 16:32:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Documentation de produit
Divers
Thread ID:
01523209
Message ID:
01523337
Vues:
29
>>>>You are confusing a value returned by datetime() function with what is dispalyed
>>>>
>>>>>
>>>>>I agree with Naomi, the Helpfile says explicit the value returned by DATETIME( ) is determined by the current SET HOURS setting. More important how can I get a 12 hour notation or am I forced to make a function?
>>>>>
>>>
>>>The Help file is confusing:
>>>
>>>Use SET HOURS TO without 12 or 24 to return to the default 12-hour format.
>>>
>>>TIME( ) always returns a value in 24-hour format and isn't affected by SET HOURS. The value returned by DATETIME( ) is determined by the current SET HOURS setting.
>>>
>>>SET HOURS is scoped to the current data session.
>>>----------------------------------------------------------------------------
>>>In my tests I got the same output for ? DATETIME() regardless on the current SET HOURS settings.
>>
>>The help file is inaccurate. TIME() returns a string value that is always 24-hour, so remains unaffected by the SET HOURS setting. As Sergey pointed out, DATETIME() returns a value that is independent of the format settings -- what *is* affected is the display format.
>
>Naoto,
>
>OK I have found the correct solution . Tell me what is the difference between the displayed format and the value of datetime() ?
>
>Regards,
>
>Koen

Sergey already explained:
> DateTime is stored internally as Date + (seconds/86400.0) and is independent of any settings. SET commands come in effect when you try to display the value or convert it to a string.

Basically what I meant by "display format" is the string representation of the datetime value. What causing part of the confusion is you're trying to display the DateTime value directly and since that involves conversion into text display (which is affected by the SET DATE and SET HOURS) you could come to the mistaken belief that DATETIME() is affected by those setting. Store the value from DATETIME() into a variable, then try displaying the value after using SET DATE and SET HOURS. You'll notice that the display changes in accordance to SET DATE and SET HOURS values -- the internal representation of the value is unchanged, only what gets displayed changes with the SET DATE and SET HOURS.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform