本文整理匯總了PHP中MkTime函數的典型用法代碼示例。如果您正苦於以下問題:PHP MkTime函數的具體用法?PHP MkTime怎麽用?PHP MkTime使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MkTime函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: JulianDayToGregorian
function JulianDayToGregorian($Julian)
{
#---------------------------------------------------------------------------
$Julian = $Julian - 1721119;
$Calc1 = 4 * $Julian - 1;
#---------------------------------------------------------------------------
$Year = Floor($Calc1 / 146097);
$Julian = Floor($Calc1 - 146097 * $Year);
$Day = Floor($Julian / 4);
$Calc2 = 4 * $Day + 3;
#---------------------------------------------------------------------------
$Julian = Floor($Calc2 / 1461);
$Day = $Calc2 - 1461 * $Julian;
$Day = Floor(($Day + 4) / 4);
$Calc3 = 5 * $Day - 3;
#---------------------------------------------------------------------------
$Month = Floor($Calc3 / 153);
$Day = $Calc3 - 153 * $Month;
$Day = Floor(($Day + 5) / 5);
$Year = 100 * $Year + $Julian;
#---------------------------------------------------------------------------
if ($Month < 10) {
$Month = $Month + 3;
} else {
#-------------------------------------------------------------------------
$Month = $Month - 9;
$Year = $Year + 1;
}
#---------------------------------------------------------------------------
return MkTime(0, 0, 0, $Month, $Day, $Year);
}
示例2: GetTime
function GetTime($Data)
{
#-------------------------------------------------------------------------------
if (Preg_Match('/^[0-9]+$/', $Data)) {
return $Data;
}
#-------------------------------------------------------------------------------
$Date = @Date_Parse($Data);
#-------------------------------------------------------------------------------
if (!Is_Array($Date)) {
return ERROR | @Trigger_Error('[GetTime]: ошибка получения даты');
}
#-------------------------------------------------------------------------------
return MkTime($Date['hour'], $Date['minute'], $Date['second'], $Date['month'], $Date['day'], $Date['year']);
#-------------------------------------------------------------------------------
}
示例3: array
$dbrs = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockID));
$ars = $dbrs->Fetch();
$date_from = MkTime(10, 0, 0, Date("n"), Date("j"), Date("Y"));
$date_to = MkTime(14, 0, 0, Date("n"), Date("j"), Date("Y"));
$iblockElementObject->Update($ars["ID"], array("ACTIVE_FROM" => ConvertTimeStamp($date_from, "FULL"), "ACTIVE_TO" => ConvertTimeStamp($date_to, "FULL")));
$ars = $dbrs->Fetch();
$date_from = MkTime(15, 0, 0, Date("n"), Date("j") + 1, Date("Y"));
$date_to = MkTime(18, 0, 0, Date("n"), Date("j") + 1, Date("Y"));
$iblockElementObject->Update($ars["ID"], array("ACTIVE_FROM" => ConvertTimeStamp($date_from, "FULL"), "ACTIVE_TO" => ConvertTimeStamp($date_to, "FULL")));
$ars = $dbrs->Fetch();
$date_from = MkTime(15, 0, 0, Date("n"), Date("j"), Date("Y"));
$date_to = MkTime(17, 0, 0, Date("n"), Date("j"), Date("Y"));
$iblockElementObject->Update($ars["ID"], array("ACTIVE_FROM" => ConvertTimeStamp($date_from, "FULL"), "ACTIVE_TO" => ConvertTimeStamp($date_to, "FULL")));
$ars = $dbrs->Fetch();
$date_from = MkTime(10, 0, 0, Date("n"), Date("j") + 1, Date("Y"));
$date_to = MkTime(12, 0, 0, Date("n"), Date("j") + 1, Date("Y"));
$iblockElementObject->Update($ars["ID"], array("ACTIVE_FROM" => ConvertTimeStamp($date_from, "FULL"), "ACTIVE_TO" => ConvertTimeStamp($date_to, "FULL")));
//IBlock fields
$iblock = new CIBlock();
$arFields = array("CODE" => $iblockCode, "XML_ID" => $iblockCode);
$iblock->Update($iblockID, $arFields);
if (!COption::GetOptionString("calendar", "rm_iblock_type") && !COption::GetOptionString("calendar", "rm_iblock_id")) {
COption::SetOptionString("calendar", "rm_iblock_type", $iblockType);
COption::SetOptionString("calendar", "rm_iblock_id", $iblockID);
}
} else {
$arSites = array();
$db_res = CIBlock::GetSite($iblockID);
while ($res = $db_res->Fetch()) {
$arSites[] = $res["LID"];
}
示例4: MkTime
$Date1 = (int) @$Args[SPrintF('%s1', $ColumnID)];
#-------------------------------------------------------------------------------
if (!$Date1) {
$Date1 = MkTime(0, 0, 0, 1, 1, 2006);
}
#-------------------------------------------------------------------------------
$Where = SPrintF('%u < `%s`', MkTime(0, 0, 0, Date('n', $Date1), Date('j', $Date1), Date('Y', $Date1)), $ColumnID);
#-------------------------------------------------------------------------------
$Template['Source']['Adding']['Where'][] = $Where;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Date2 = (int) @$Args[SPrintF('%s2', $ColumnID)];
#-------------------------------------------------------------------------------
if ($Date2) {
#-------------------------------------------------------------------------------
$Where = SPrintF('`%s` < %u', $ColumnID, MkTime(23, 59, 59, Date('n', $Date2), Date('j', $Date2), Date('Y', $Date2)));
#-------------------------------------------------------------------------------
$Template['Source']['Adding']['Where'][] = $Where;
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Tr = new Tag('TR', new Tag('TD', 'С даты'));
#-------------------------------------------------------------------------------
$Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s1', $ColumnID), $Date1 ? $Date1 : Time() - 189216000);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tr->AddChild(new Tag('TD', $Comp));
#-------------------------------------------------------------------------------
示例5: Comp_Load
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------
if ($Count) {
continue;
}
#---------------------------------------------------------------------
$MotionDocument = Comp_Load('www/Administrator/API/MotionDocumentEdit', array('TypeID' => 'WorksCompliteReport', 'ContractID' => $ContractID, 'AjaxCall' => array('Url' => '/WorksCompliteReportDownload', 'Args' => array('ContractID' => $ContractID, 'Month' => $RegistrationMonth, 'IsStamp' => 'yes')), 'UniqID' => $UniqID));
#---------------------------------------------------------------------
switch (ValueOf($MotionDocument)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
continue;
default:
return ERROR | @Trigger_Error(101);
}
break;
default:
return ERROR | @Trigger_Error(101);
}
}
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
return MkTime(4, 0, 0, Date('n') + 1, 1, Date('Y'));
#-------------------------------------------------------------------------------
示例6: array
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------
$Contract['CreateDate'] = $Comp;
#---------------------------------------------------------------
$Replace = array('Contract' => $Contract);
#---------------------------------------------------------------
$Year = (int) ($Month / 12);
/* Date('t',MkTime(0,0,0,$Month - $Year*12,1,$Year + 1970)) */
#---------------------------------------------------------------
$Config = Config();
$ReportDate = $Config['Executor']['WorksCompliteDate'];
#---------------------------------------------------------------
# $Comp = Comp_Load('Formats/Date/Standard',MkTime(0,0,0,($Month + 1) - $Year*12,1,$Year + 1970));
$Comp = Comp_Load('Formats/Date/Standard', MkTime(0, 0, 0, $Month + 1 - $Year * 12, $ReportDate, $Year + 1970));
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------
$Replace['SignDate'] = $Comp;
#---------------------------------------------------------------
$ProfileID = (int) $Contract['ProfileID'];
#---------------------------------------------------------------
if ($ProfileID) {
#-------------------------------------------------------------
$Profile = Comp_Load('www/Administrator/API/ProfileCompile', array('ProfileID' => $ProfileID));
#-------------------------------------------------------------
switch (ValueOf($Profile)) {
case 'error':
return ERROR | @Trigger_Error(500);
示例7: gException
case 'exception':
return new gException('CONTRACT_NOT_FOUND', 'Договора не найдены');
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/Tasks/GC/WithdrawalOldUsers]: юзер (%s), договор #%u, балланс %s', $User['Email'], $Contract['ID'], $Contract['Balance']));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Settings['WithdrawSumm'] = Str_Replace(',', '.', $Settings['WithdrawSumm']);
#-------------------------------------------------------------------------------
$Summ = $Contract['Balance'] > $Settings['WithdrawSumm'] ? $Settings['WithdrawSumm'] : $Contract['Balance'];
#-------------------------------------------------------------------------------
$IsUpdate = Comp_Load('www/Administrator/API/PostingMake', array('ContractID' => $Contract['ID'], 'Summ' => -$Summ, 'ServiceID' => 2100, 'Comment' => SPrintF('Хранение клиентской информации за период %s', Date('Y/m', MkTime(4, 0, 0, Date('n') - 1, 5, Date('Y'))))));
#-------------------------------------------------------------------------------
switch (ValueOf($IsUpdate)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['IsEvent']) {
continue;
示例8: StrToTime
}
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/Tasks/ISPswCheckLicenses]: IP = %s; elid = %u; addon = %s',$License['ip'],$License['id'],$Comp));
$addon = 1;
#-------------------------------------------------------------------------------
if ($Comp) {
if (isset($License[$Comp])) {
$addon = $License[$Comp];
}
}
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/Tasks/ISPswCheckLicenses]: addon name = %s; addon value = %s',$Comp,$addon));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$ExpireDate = StrToTime($License['expiredate']);
$ExpireDate = MkTime(23, 59, 59, date("m", $ExpireDate), date("d", $ExpireDate), date("Y", $ExpireDate));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Statuses = $Config['Statuses']['ISPswLicenses'];
#-------------------------------------------------------------------------------
$StatusID = "UnSeted";
#-------------------------------------------------------------------------------
#Debug(SPrintF("[comp/Tasks/ISPswCheckLicenses]: Statuses = %s",print_r($Statuses, true)));
foreach (Array_Keys($Statuses) as $Status) {
if ($Statuses[$Status]['status'] == $License['status']) {
$StatusID = $Status;
}
}
#-------------------------------------------------------------------------------
#----------------------------------TRANSACTION----------------------------------
if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/ISPswCheckLicenses')))) {
示例9: switch
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
# No more...
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$StartHour = $Config['Tasks']['Types']['DSForDelete']['StartHour'];
$StartMinutes = $Config['Tasks']['Types']['DSForDelete']['StartMinutes'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return MkTime($StartHour, $StartMinutes, 0, Date('n'), Date('j') + 1, Date('Y'));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例10: Comp_Load
$ExecuteTime = Comp_Load('Formats/Task/ExecuteTime', array('ExecuteTime' => $Settings['ExecuteTime'], 'ExecuteDayOfMonth' => $Settings['ExecuteDayOfMonth'], 'ExecuteMonths' => $Settings['ExecuteMonths'], 'DefaultTime' => MkTime(4, 0, 0, Date('n') + 1, 5, Date('Y'))));
if (Is_Error($ExecuteTime)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
# если неактивна, то через день запуск
if (!$Settings['IsActive']) {
return $ExecuteTime;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# vars
$TotalSumm = 0;
$MessageToAdmins = "Начисления по реферальной программе за прошлый месяц:\n\n";
$MonthsNames = array('Декабрь', 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь');
$PreviousTime = MkTime(4, 0, 0, Date('n') - 1, 5, Date('Y'));
$PreviousYear = date('Y', $PreviousTime);
$PreviousMonthName = $MonthsNames[date('n', $PreviousTime)];
$Theme = "Начисления по партнёрской программе за " . SPrintF("%s %u г.", $PreviousMonthName, $PreviousYear);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# create temporary table
$Result = DB_Query("CREATE TEMPORARY TABLE `UsrOwners` SELECT DISTINCT `OwnerID` as `DistinctOwnerID`, (SELECT `Email` FROM `Users` WHERE `ID`=`DistinctOwnerID`) AS `Email`, COUNT(`ID`) AS `NumDependUsers` FROM `Users` WHERE `OwnerID`!=1 GROUP BY `OwnerID`");
#-------------------------------------------------------------------------------
if (Is_Error($Result)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Owners = DB_Select('UsrOwners', '*');
switch (ValueOf($Owners)) {
示例11: Date
# если задана периодичность в днях - добавляем период, дней
$ExecuteDay = Date('j') + (isset($Params['ExecuteDays']) ? IntVal($Params['ExecuteDays']) : 0);
#-------------------------------------------------------------------------------
# если задан точный день месяца - устанавливаем его
$ExecuteDay = isset($Params['ExecuteDayOfMonth']) ? IntVal($Params['ExecuteDayOfMonth']) : $ExecuteDay;
#-------------------------------------------------------------------------------
# если задана периодичнось в месяцах, добавляем период, месяцев
$ExecuteMonth = Date('n') + (isset($Params['ExecuteMonths']) ? IntVal($Params['ExecuteMonths']) : 0);
#-------------------------------------------------------------------------------
# если задан точный месяц - устанавливаем его
$ExecuteMonth = isset($Params['ExecuteMonth']) ? IntVal($Params['ExecuteMonth']) : $ExecuteMonth;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ((int) $Time[0] >= 0 && (int) $Time[0] <= 23 && (int) $Time[1] >= 0 && (int) $Time[1] <= 59) {
#-------------------------------------------------------------------------------
return MkTime((int) $Time[0], (int) $Time[1], 0, $ExecuteMonth, $ExecuteDay, Date('Y'));
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
return $Params['DefaultTime'];
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
return $Params['DefaultTime'];
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
示例12: array
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Stamp');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
if ($Stamp < 1) {
return '-';
}
#-------------------------------------------------------------------------------
$Day = Date('d', $Stamp);
$Month = Date('m', $Stamp);
$Year = Date('y', $Stamp);
#-------------------------------------------------------------------------------
$Time = Date('H:i', $Stamp);
#-------------------------------------------------------------------------------
if (MkTime(0, 0, 0, $Month, $Day, $Year) == MkTime(0, 0, 0, Date('n'), Date('j'), Date('y'))) {
return SPrintF('Сегодня в %s', $Time);
}
#-------------------------------------------------------------------------------
if (MkTime(0, 0, 0, $Month, $Day, $Year) == MkTime(0, 0, 0, Date('n'), Date('j') - 1, Date('y'))) {
return SPrintF('Вчера в %s', $Time);
}
#-------------------------------------------------------------------------------
if (MkTime(0, 0, 0, $Month, $Day, $Year) == MkTime(0, 0, 0, Date('n'), Date('j') + 1, Date('y'))) {
return SPrintF('Завтра в %s', $Time);
}
#-------------------------------------------------------------------------------
return SPrintF('%02u.%02u.%02u в %s', $Day, $Month, $Year, $Time);
#-------------------------------------------------------------------------------
示例13: array
$arFilter["!ID"] = $arItem["ID"];
}
$dbElements = CIBlockElement::GetList(array("DATE_ACTIVE_FROM" => "ASC"), $arFilter, false, false, array());
while ($arElements = $dbElements->GetNext()) {
$ft1 = MakeTimeStamp($arElements["DATE_ACTIVE_FROM"], FORMAT_DATETIME);
$ft2 = MakeTimeStamp($arElements["DATE_ACTIVE_TO"], FORMAT_DATETIME);
$errorMessage .= Str_Replace(array("#TIME1#", "#TIME2#", "#RES#"), array("<b>" . Date("H:i", $ft1) . "</b> " . Date("d.m", $ft1), "<b>" . Date("H:i", $ft2) . "</b> " . Date("d.m", $ft2), $arElements["NAME"]), GetMessage("INTASK_C29_CONFLICT") . ". ");
}
$arPeriodicElements = __IRM_SearchPeriodic($fromDateTime, $toDateTime, $arMeeting["IBLOCK_ID"], $arMeeting["ID"], $arItem ? $arItem["ID"] : 0);
foreach ($arPeriodicElements as $pe) {
$errorMessage .= Str_Replace(array("#TIME1#", "#TIME2#", "#RES#"), array("<b>" . Date("H:i", $pe["DATE_ACTIVE_FROM_TIME"]) . "</b> " . Date("d.m", $pe["DATE_ACTIVE_FROM_TIME"]), "<b>" . Date("H:i", $pe["DATE_ACTIVE_TO_TIME"]) . "</b> " . Date("d.m", $pe["DATE_ACTIVE_TO_TIME"]), $pe["NAME"]), GetMessage("INTASK_C29_CONFLICT") . ". ");
}
} else {
$t = MakeTimeStamp($startDateV, FORMAT_DATE);
$fromDateTime = MkTime($arStartTimeVTmp[0], $arStartTimeVTmp[1], 0, Date("m", $t), Date("d", $t), Date("Y", $t));
$toDateTime = MkTime($arStartTimeVTmp[0] + $arTimeoutTimeVTmp[0], $arStartTimeVTmp[1] + ($arTimeoutTimeVTmp[1] == "5" ? 30 : 0), 0, Date("m", $t), Date("d", $t), Date("Y", $t));
$regularityLength = $toDateTime - $fromDateTime;
$toDateTime = MakeTimeStamp($regularityEndV, FORMAT_DATE);
}
}
if (StrLen($errorMessage) <= 0) {
$arFields = array("NAME" => $nameV, "DATE_ACTIVE_FROM" => Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $fromDateTime), "DATE_ACTIVE_TO" => Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $toDateTime), "CREATED_BY" => $GLOBALS["USER"]->GetID(), "DETAIL_TEXT" => $descriptionV, "PROPERTY_VALUES" => array($arResult["ALLOWED_ITEM_PROPERTIES"]["UF_PERSONS"]["ID"] => array($personsV), $arResult["ALLOWED_ITEM_PROPERTIES"]["UF_RES_TYPE"]["ID"] => array($resTypeV), $arResult["ALLOWED_ITEM_PROPERTIES"]["UF_PREPARE_ROOM"]["ID"] => array($prepareRoomV), $arResult["ALLOWED_ITEM_PROPERTIES"]["PERIOD_TYPE"]["ID"] => array($regularityV), $arResult["ALLOWED_ITEM_PROPERTIES"]["PERIOD_COUNT"]["ID"] => array($regularityCountV), $arResult["ALLOWED_ITEM_PROPERTIES"]["EVENT_LENGTH"]["ID"] => array($regularityLength), $arResult["ALLOWED_ITEM_PROPERTIES"]["PERIOD_ADDITIONAL"]["ID"] => array($regularityAdditionalVString)), "ACTIVE" => "Y");
$iblockElementObject = new CIBlockElement();
if ($arItem) {
$res = $iblockElementObject->Update($arItem["ID"], $arFields);
} else {
$arFields["IBLOCK_ID"] = $arMeeting["IBLOCK_ID"];
$arFields["IBLOCK_SECTION_ID"] = $arMeeting["ID"];
$idTmp = $iblockElementObject->Add($arFields);
$res = $idTmp > 0;
}
示例14: DB_Select
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# перебираем группы серверов, ищщем те где автобалансировка не отключена
$ServersGroups = DB_Select('ServersGroups', array('*'), array('Where' => '`FunctionID` != "NotDefined"'));
switch (ValueOf($ServersGroups)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
#-------------------------------------------------------------------------------
Debug('[comp/Tasks/ServersAutoBalance]: no groups with enabled autobalasing, go to next day');
#-------------------------------------------------------------------------------
$GLOBALS['TaskReturnInfo'] = 'No servers groups with enabled AutoBalance';
#-------------------------------------------------------------------------------
return MkTime(2, 50, 0, Date('n'), Date('j') + 1, Date('Y'));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
case 'array':
# All OK, servers found
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$GLOBALS['TaskReturnInfo'] = array();
#-------------------------------------------------------------------------------
foreach ($ServersGroups as $ServersGroup) {
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/Tasks/ServersAutoBalance]: processing group #%s, %s', $ServersGroup['ID'], $ServersGroup['Name']));
示例15: array
#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('ExpirationDate', 'YearsRemainded');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
if (!($ExpirationDate || $YearsRemainded)) {
return '-';
}
#-------------------------------------------------------------------------------
$ExpirationDate = Max($ExpirationDate, Time());
#-------------------------------------------------------------------------------
if ($YearsRemainded) {
#-----------------------------------------------------------------------------
$Date = array();
#-----------------------------------------------------------------------------
foreach (array('H', 'i', 's', 'm', 'd', 'Y') as $Element) {
$Date[$Element] = Date($Element, $ExpirationDate);
}
#---------------------------------------------------------------------------
$Date['Y'] += $YearsRemainded;
#---------------------------------------------------------------------------
$ExpirationDate = MkTime($Date['H'], $Date['i'], $Date['s'], $Date['m'], $Date['d'], $Date['Y']);
}
#-------------------------------------------------------------------------------
return new Tag('DIV', array('style' => SPrintF('color:#%s;text-decoration:underline;', $ExpirationDate - Time() < 2592000 ? 'FF0000' : '1E2E07')), new Tag('SPAN', Date('d.m.y', $ExpirationDate)), new Tag('SPAN', SPrintF('| %u дн.', Ceil(($ExpirationDate - Time()) / 86400))));
#-------------------------------------------------------------------------------