xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Secs()

Calculates the number of seconds from a time string.

Syntax

Secs( <cTime>|<dDateTime> ) --> nSeconds

Arguments

<cTime>
This is a character string formatted as hh:mm:ss. It holds a time string based on a 24h clock.
<dDateTime>
Instead of a time string, the function accepts a DateTime() value.

Return

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).

Description

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

Info

See also:DateTime(), ElapTime(), Hour(), Minute(), Seconds(), Time(), TString()
Category: Date and time
Source:rtl\samples.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe