Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime2character
Message
From
08/01/2001 02:49:26
 
 
To
06/01/2001 09:12:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00460191
Message ID:
00460439
Views:
12
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform