Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

look::LookDateTimeFormatter Class Reference

Class for formatting date/times. More...

#include <lkdatetimeformatter.h>

List of all members.

Static Public Methods

LookString FormatDate (const LookDate &theDate, const LookString &theFormatModel)
 Format a date. More...

LookString FormatTime (const LookTime &theTime, const LookString &theFormatModel)
 Format a time. More...

LookString FormatDateTime (const LookDateTime &theDateTime, const LookString &theFormatModel)
 Format a date time.


Detailed Description

Class for formatting date/times.

Example date (a) is 14 July 1999, (b) is 3 July 345 BC

The following format models are supported:

	CC SCC      19 19  3 -3
	YYYY SYYYY   1999 1999,   345 -345
	YYY YY Y    999 99 9,   345, 45, 5
	Y,YYY       1,999
	YEAR SYEAR   ONE THOUSAND NINE HUNDRED AND NINETY NINE
	(S adds a - in front for BC)
	BC or AD    AD   BC
	B.C. or A.D   A.D.   B.C.

    (Actually S, YEAR and BC/AD aren't supported yet, especially as LookDate
	doesn't support years before 1752).

	Q    (quarter, jan-mar = q1)  3
	MM month   07
	MONTH   name 'JULY     ' (padded to 9 chars)
	MON     name as 3 char abbrev  JUL
	WW      week of year
	W       week of month
	DDD     day of year
	DD      day of month
	D       day of week
	DAY     name of day (WEDNESDAY) (padded to 9 chars)
	DY      name of day as 3 char (WED)

	J       julian day (not supported)

	HH      hours (1-12)
	HH24    hours (0-23)
	MI      minute (0-59)
	SS      second (0-59)
	SSSSS   second of day (0-86399)
	AM      'AM' or 'PM'
	PM      ditto

	/.,-:;    punctuation stays as it was (as does space)
	"blah"  'blah' gets put in
	to include quotes string, use \" not "" (easier on me!)
	FM      toggles suppression of blank padding for MONTH and DAY
	        and removal of leading zeros
	        eg MONTH MM FM MONTH MM FM MONTH MM will give
	        July      07 July 7 July      07
	TH      append to eg DD to get 7TH
	SP      append to eg DD to spell it out SEVEN
	THSP/SPTH spelled out ordinal - FOURTH

	Capitalisation follows format model,
	eg FM Month mONTH month MONTH gives July jULY july JULY

	I think everything else gets ignored
	

The format model is much the same as used for TO_CHAR in Oracle.


Member Function Documentation

LookString look::LookDateTimeFormatter::FormatDate ( const LookDate & theDate,
const LookString & theFormatModel ) [static]
 

Format a date.

Use theFormatModel to get a theDate as a string.

Eg "DD-Mon-YYYY" will give "26-Jun-2001".

Parameters:
theDate   Date
theFormatModel   Format Model
Returns:
Converted string

LookString look::LookDateTimeFormatter::FormatTime ( const LookTime & theTime,
const LookString & theFormatModel ) [static]
 

Format a time.

Use theFormatModel to get a theTime as a string.

Eg "HH24:MI:SS" will give "22:45:32".

Parameters:
theTime   Time
theFormatModel   Format Model
Returns:
Converted string


The documentation for this class was generated from the following files:
Generated at Thu Jan 17 12:53:08 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001