Class SGL_Date

Description

Provides various date formatting methods.

Located in /SGL/Date.php (line 47)


	
			
Method Summary
 static string getTime ([boolean $gmt = false])
 string arrayToString (array $aDate)
 string format ( $date, string $input)
 string formatPretty (string $date)
 string getDateFormat ()
 string getDayFormOptions ([string $selected = ''])
 string getHourFormOptions ([string $selected = ''])
 string getMinSecOptions ([string $selected = ''])
 string getMonthFormOptions ([string $selected = ''])
 string getYearFormOptions ([string $selected = ''], [boolean $asc = true], [ $totalYears = 5], int $number)
 string showDateSelector (array $aDate, string $elementName, [boolean $bShowTime = true], [bool $asc = true], [int $years = 5])
 array stringToArray (string $sDate)
Methods
static getTime (line 60)

Returns current time in YYYY-MM-DD HH:MM:SS format.

GMT format is best for logging system events, otherwise locale offset will be most helpful to users.

  • return: formatted current time
  • access: public
string getTime ([boolean $gmt = false])
  • boolean $gmt: is time GMT or locale offset
arrayToString (line 76)

Converts date array into MySQL datetime format.

  • return: MySQL datetime format
  • see: publisher::ArticleMgr::process/edit
  • access: public
string arrayToString (array $aDate)
  • array $aDate
format (line 160)

Converts date (may be in the ISO, TIMESTAMP or UNIXTIME format) into locale dependent form.

  • return: user-friendly format (locale dependent)
  • access: public
string format ( $date, string $input)
  • string $input: date (may be in the ISO, TIMESTAMP or UNIXTIME format) value
  • $date
formatPretty (line 126)

Converts date (may be in the ISO, TIMESTAMP or UNIXTIME format) into "Mar 31, 2003 18:29".

  • return: user-friendly format (european)
  • access: public
string formatPretty (string $date)
  • string $date: Date (may be in the ISO, TIMESTAMP or UNIXTIME format) value
getDateFormat (line 195)

Gets appropriate date format

  • return: template (e.g. "%d %B %Y, %H:%M" for FR date format)
  • access: public
string getDateFormat ()
getDayFormOptions (line 222)

Generates a select of day values.

string getDayFormOptions ([string $selected = ''])
  • string $selected
getHourFormOptions (line 312)

Generates a select of hour values.

string getHourFormOptions ([string $selected = ''])
  • string $selected
getMinSecOptions (line 336)

Generates a select of minute/second values.

string getMinSecOptions ([string $selected = ''])
  • string $selected
getMonthFormOptions (line 245)

Generates a select of month values.

string getMonthFormOptions ([string $selected = ''])
  • string $selected
getYearFormOptions (line 277)

Generates a select of year values.

string getYearFormOptions ([string $selected = ''], [boolean $asc = true], [ $totalYears = 5], int $number)
  • string $selected
  • boolean $asc
  • int $number: number of years to show
  • $totalYears
showDateSelector (line 380)

Generates date/time selector widget.

usage: $timestamp=mktime(); $day = date('d', $timestamp); $month = date('m', $timestamp); $year = date('Y', $timestamp); $hour = date('H', $timestamp); $minute = date('i', $timestamp); $second = date('s', $timestamp);

$aDate = array( 'day' => $day, 'month' => $month, 'year' => $year, 'hour' => $hour, 'minute' => $minute, 'second' => $second); print showDateSelector($aDate, 'myForm', false);

  • return: html for widget
  • access: public
string showDateSelector (array $aDate, string $elementName, [boolean $bShowTime = true], [bool $asc = true], [int $years = 5])
  • array $aDate
  • string $elementName: name of the html element
  • boolean $bShowTime: toggle to display HH:MM:SS
  • bool $asc
  • int $years: number of years to show
stringToArray (line 103)

Converts date into date array.

  • see: publisher::ArticleMgr::process/edit
  • access: public
array stringToArray (string $sDate)
  • string $sDate: date (may be in the ISO, TIMESTAMP or UNIXTIME format) format

Documentation generated on Tue, 23 Feb 2010 18:14:29 +0000 by phpDocumentor 1.4.3