xHarbour Reference Documentation > Function Reference |
Calculates the number of seconds from a time string.
Secs( <cTime>|<dDateTime> ) --> nSeconds
When a time string is passed, the function returns a numeric value representing the number of seconds corresponding to the input string.
When a DateTime value is passed, the function extracts the number of seconds of the DateTime value (:ss.ccc).
Secs() is a time conversion function that accepts a Time() compliant character string and calculates from it the corresponding number of seconds. The reverse function of Secs() is TSTring().
Alternatively, the Seconds part of a DatTime value is returned
See also: | DateTime(), ElapTime(), Hour(), Minute(), Seconds(), Time(), TString() |
Category: | Date and time |
Source: | rtl\samples.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates return values of Secs() PROCEDURE Main LOCAL dDateTime := {ˆ 2007/04/26 18:31:59.789 } ? Secs( "23:59:59" ) // result: 86399 ? Secs( "00:00:00" ) // result: 0 ? Secs( "12:00:00" ) // result: 43200 ? Time() // result: 16:07:34 ? Secs( Time() ) // result: 58054 ? Secs( dDateTime ) // result: 59.789 RETURN
http://www.xHarbour.com