mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
documentation update and extra param to show_date, to disable time-zone-conversation
This commit is contained in:
parent
99bfc937e1
commit
23ea4159ef
@ -1494,12 +1494,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show current date
|
* return a formatted timestamp or current time
|
||||||
*
|
*
|
||||||
* @param $t time - optional can be pulled from user preferences
|
* @param int $t=0 timestamp, default current time
|
||||||
* @param $format - optional can be pulled from user prefernces
|
* @param string $format='' timeformat, default '' = read from the user prefernces
|
||||||
|
* @param boolean $adjust_to_usertime=true should datetime::tz_offset be added to $t or not, default true
|
||||||
|
* @return string the formated date/time
|
||||||
*/
|
*/
|
||||||
function show_date($t = '', $format = '')
|
function show_date($t = 0, $format = '', $adjust_to_usertime=true)
|
||||||
{
|
{
|
||||||
if(!is_object($GLOBALS['egw']->datetime))
|
if(!is_object($GLOBALS['egw']->datetime))
|
||||||
{
|
{
|
||||||
@ -1511,10 +1513,12 @@
|
|||||||
$t = $GLOBALS['egw']->datetime->gmtnow;
|
$t = $GLOBALS['egw']->datetime->gmtnow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// + (date('I') == 1?3600:0)
|
if ($adjust_to_usertime)
|
||||||
$t += $GLOBALS['egw']->datetime->tz_offset;
|
{
|
||||||
|
$t += $GLOBALS['egw']->datetime->tz_offset;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $format)
|
if (!$format)
|
||||||
{
|
{
|
||||||
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' - ';
|
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' - ';
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
|
if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
|
||||||
@ -1530,11 +1534,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* Format a date according to the user preferences
|
||||||
* @param $yearstr year - string
|
*
|
||||||
* @param $monthstr month - string
|
* @param string $yearstr year
|
||||||
* @param $day day - string
|
* @param string $monthstr month
|
||||||
* @param $add_seperator boolean defaults to false
|
* @param string $day day
|
||||||
|
* @param boolean $add_seperator=false add the separator specifed in the prefs or not, default no
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function dateformatorder($yearstr,$monthstr,$daystr,$add_seperator = False)
|
function dateformatorder($yearstr,$monthstr,$daystr,$add_seperator = False)
|
||||||
{
|
{
|
||||||
@ -1548,20 +1554,18 @@
|
|||||||
|
|
||||||
if ($add_seperator)
|
if ($add_seperator)
|
||||||
{
|
{
|
||||||
return (implode($sep,$dlarr));
|
return implode($sep,$dlarr);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (implode(' ',$dlarr));
|
|
||||||
}
|
}
|
||||||
|
return implode(' ',$dlarr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format the time takes settings from user preferences
|
* format the time takes settings from user preferences
|
||||||
*
|
*
|
||||||
* @param $hour hour
|
* @param int $hour hour
|
||||||
* @param $min minutes
|
* @param int $min minutes
|
||||||
* @param $sec defaults to ''
|
* @param int/string $sec='' defaults to ''
|
||||||
|
* @return string formated time
|
||||||
*/
|
*/
|
||||||
function formattime($hour,$min,$sec='')
|
function formattime($hour,$min,$sec='')
|
||||||
{
|
{
|
||||||
@ -1595,10 +1599,10 @@
|
|||||||
|
|
||||||
if ($sec !== '')
|
if ($sec !== '')
|
||||||
{
|
{
|
||||||
$sec = ":$sec";
|
$sec = ':'.$sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$h12:$min$sec$ampm";
|
return $h12.':'.$min.$sec.$ampm;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
||||||
|
Loading…
Reference in New Issue
Block a user