xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET TIME

Specifies the time format for input and display.

Syntax

SET TIME FORMAT [TO] "hh[:mm][:ss][.ccc] [PM]"

or

SET TIME FORMAT [TO] (<cTimeFormat>)

Arguments

TO "hh[:mm][:ss][.ccc] [AM|PM]"
This is a literal time format string. It must be coded in the sequence Hour:Minute:Second where the colon is used as default delimiter. Optionally, the seconds value can be followed by a period and up to three digits (.ccc) indicating fractions of a second in milliseconds.

When the time should be formatted using a 12 hour clock, the suffix PM can be added. It must be separated with a blank space.

TO <cTimeFormat>
Instead of a literal time format string, a character expression enclosed in parentheses can be specified.

Description

The SET TIME command specifies the format for the display of the Time part of DateTime() values. It is a global setting valid for an entire xHarbour application.

Info

See also:DateTime(), Set(), SET CENTURY, SET DATE, SET EPOCH
Category: SET commands , xHarbour extensions
Source:rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates different Date and Time formatting
// of a DateTime value

   PROCEDURE Main
      
      LOCAL dDateTime := {ˆ 2007/04/26 16:31:24.789 }
 
      ? Set(_SET_TIMEFORMAT)           // result:  hh:mm:ss.cc

      ? dDateTime                      // result:  04/26/07 16:31:24.78

      SET TIME FORMAT TO "hh:mm pm"

      ? dDateTime                      // result:  04/26/07 04:31 PM

      SET DATE TO ITALIAN
      SET CENTURY ON
      SET TIME FORMAT TO "hh|mm|ss"

      ? dDateTime                      // result:  26-04-2007 16|31|24
   RETURN 

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