xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Time()

Retrieves the system time as a formatted character string.

Syntax

Time() --> cHHMMSS

Return

The function returns a character string containing the system time formatted as hh:mm:ss.

Description

Time() is used to obtain a time formatted character string containing hours, minutes and seconds of a 24h clock.

Info

See also:AmPm(), Date(), Seconds(), SubStr()
Category: Date and time
Source:rtl\dateshb.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows the results of Time() and how to extract
// hour, minutes, and seconds

   PROCEDURE Main
      LOCAL cTime := Time()
      LOCAL cHour, cMin, cSec

      ? cTime                        // Result: 13:27:47
      cSec  := Right ( cTime, 2 )
      cMin  := SubStr( cTime, 3, 2 )
      cHour := Left  ( cTime, 2 )

      ? Val( cHour ) * 3600 + Val( cMin ) * 60 + Val( cSec )
                                     // result: 48467.00
   RETURN

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