Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datetime2character
Message
De
08/01/2001 02:49:26
 
 
À
06/01/2001 09:12:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00460191
Message ID:
00460439
Vues:
11
>How to convert a datetime expression to a character expression?
>How to find the time in a datetime expression?

You can extract the time portion of a datetime as a number of seconds offset from midnight by:

nTimeInSeconds = tDateTime - DTOT(TTOD(tDateTime))

To convert a numeric variable into a human readable time expressed in hours, minutes and seconds for times less than 24 hours, try:

cTimeString = TTOC(TTOD(DATE()) + nTimeInSeconds,2)

Others have already pointed you to TTOC() to convert the datetime to a character string representing either the date and time as a human readable string ( use TTOC() with no second parameter), as a sortable character expression (you can use TTOC(...,1) to concatenate a datetime into a composite key expression) or a human-reaable time string (use TTOC(...,2) for this).

TRANFORM behaves like TTOC() with no second parameter.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform