| xHarbour Reference Documentation > Command Reference |
![]() |
![]() |
![]() |
Specifies the time format for input and display.
SET TIME FORMAT [TO] "hh[:mm][:ss][.ccc] [PM]" or SET TIME FORMAT [TO] (<cTimeFormat>)
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.
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.
| 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 |
// 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
http://www.xHarbour.com