本文整理汇总了PHP中getDate函数的典型用法代码示例。如果您正苦于以下问题:PHP getDate函数的具体用法?PHP getDate怎么用?PHP getDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* Formulaire d'entité activité
* @param $builder <i>FormBuilderInterface<i/>
* @param $options <i>Array</i>
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$today = getDate();
//$jour = $today['wday'];
$annee = $today['year'];
$builder->add('sportPratique', 'entity', array('label' => 'Sport', 'empty_value' => 'Sélectionnez un sport', 'class' => 'mooveActiviteBundle:Sport', 'property' => 'nom', 'multiple' => false, 'expanded' => false))->add('niveauRequis', 'entity', array('label' => 'Niveau conseillé', 'empty_value' => 'Sélectionez un niveau', 'class' => 'mooveActiviteBundle:Niveau', 'property' => 'libelle', 'multiple' => false, 'expanded' => false))->add('dateHeureRDV', 'datetime', array('label' => 'Date et heure de rendez-vous', 'years' => range($annee, $annee + 5)))->add('dateFermeture', 'datetime', array('label' => 'Date et heure de fermeture de l\'activité', 'years' => range($annee, $annee + 5)))->add('duree', 'time', array('label' => 'Durée estimée'))->add('nbPlaces', 'integer', array('label' => 'Nombre de places total (vous inclus)'))->add('description', 'ckeditor', array('required' => false, 'label' => 'Informations', 'config_name' => 'config_description'))->add('adresseLieuRDV', 'text', array('constraints' => new Adresse()))->add('adresseLieuDepart', 'text', array('required' => false, 'constraints' => new Adresse()))->add('adresseLieuArrivee', 'text', array('required' => false, 'constraints' => new Adresse()));
}
示例2: Calendar
/**
* Construct
*
* @param $str_date Any String formatted date understood by strtotime()
* @link http://www.php.net/manual/en/function.strtotime.php
*/
function Calendar($str_date = 'now')
{
$this->time = strtotime($str_date);
$this->date = getDate($this->time);
// use current month and year if not supplied
$month = $this->date['mon'];
$year = $this->date['year'];
// get the dates for the start of this month and next month
// we don't worry about month=13 as mktime() will take care of this
$this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
$next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
// http://scripts.franciscocharrua.com/php-calendar.php
$this->day = $this_month["mday"];
$this->month = $this_month["mon"];
$this->month_name = $this_month["month"];
$this->year = $this_month["year"];
$this->first_day_offset = $this_month["wday"];
$this->days_count = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
$this->days = array();
// fill in days
$week = 1;
for ($i = 0; $i < $this->days_count + $this->first_day_offset; $i++) {
if ($i < $this->first_day_offset) {
$this->days[$week][] = null;
} else {
$this->days[$week][] = $i - $this->first_day_offset + 1;
}
if ($i % 7 == 6) {
$week++;
}
}
// localized day names
$this->day_names = $this->_getFullDayNames();
}
示例3: init
/**
* Initialize the Home Page
*
* Gather billing stats and account stats from the database, then assign those
* stats to template variables.
*/
function init()
{
parent::init();
// Current month
$now = getDate(time());
$this->smarty->assign("month", $now['month']);
// Invoice Summary
$stats = outstanding_invoices_stats();
$this->smarty->assign("os_invoices_count", $stats['count']);
$this->smarty->assign("os_invoices_total", $stats['total']);
$this->smarty->assign("os_invoices_count_past_due", $stats['count_past_due']);
$this->smarty->assign("os_invoices_total_past_due", $stats['total_past_due']);
$this->smarty->assign("os_invoices_count_past_due_30", $stats['count_past_due_30']);
$this->smarty->assign("os_invoices_total_past_due_30", $stats['total_past_due_30']);
// Payment Summary
$stats = payments_stats();
$this->smarty->assign("payments_count", $stats['count']);
$this->smarty->assign("payments_total", $stats['total']);
// Account Summary
$active_accounts = count_all_AccountDBO("status='Active'");
$inactive_accounts = count_all_AccountDBO("status='Inactive'");
$pending_accounts = count_all_AccountDBO("status='Pending'");
$total_accounts = $active_accounts + $inactive_accounts;
$this->smarty->assign("active_accounts_count", $active_accounts);
$this->smarty->assign("inactive_accounts_count", $inactive_accounts);
$this->smarty->assign("pending_accounts_count", $pending_accounts);
$this->smarty->assign("total_accounts", $total_accounts);
}
示例4: getWTCdate
function getWTCdate($value)
{
utc_timezone();
// "Year and only year" (i.e. 1960) will be treated as HH SS by default
if (strlen($value) == 4) {
// Assume this is a year:
$value = "Jan 1 " . $value;
} else {
if (preg_match("/\\d{4}\\-\\d{2}/", $value) === 1) {
$value = $value . "-01";
}
}
if (($timestamp = strtotime($value)) === false) {
return false;
} else {
$date = getDate($timestamp);
if ($date['year'] > $this->maxYear) {
$this->maxYear = $date['year'];
}
if ($date['year'] < $this->minYear) {
$this->minYear = $date['year'];
}
return date('Y-m-d\\TH:i:s\\Z', $timestamp);
}
reset_timezone();
}
示例5: tTimeFormat
/**
* timestamp转换成显示时间格式
* @param $timestamp
* @return unknown_type
*/
public static function tTimeFormat($timestamp)
{
$curTime = time();
$space = $curTime - $timestamp;
//1分钟
if ($space < 60) {
$string = "刚刚";
return $string;
} elseif ($space < 3600) {
//一小时前
$string = floor($space / 60) . "分钟前";
return $string;
}
$curtimeArray = getdate($curTime);
$timeArray = getDate($timestamp);
if ($curtimeArray['year'] == $timeArray['year']) {
if ($curtimeArray['yday'] == $timeArray['yday']) {
$format = "%H:%M";
$string = strftime($format, $timestamp);
return "今天 {$string}";
} elseif ($curtimeArray['yday'] - 1 == $timeArray['yday']) {
$format = "%H:%M";
$string = strftime($format, $timestamp);
return "昨天 {$string}";
} else {
$string = sprintf("%d月%d日 %02d:%02d", $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
return $string;
}
}
$string = sprintf("%d年%d月%d日 %02d:%02d", $timeArray['year'], $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
return $string;
}
示例6: __construct
public function __construct(&$doorGets)
{
$this->doorGets = $doorGets;
$time = time();
$range = array('month');
$limitMax = $time - 86400;
$isUser = $doorGets->dbQA('_users_info', ' ORDER BY date_creation ASC LIMIT 1');
if (!empty($isUser)) {
$limitMax = (int) $isUser[0]['date_creation'];
}
//$limitMax = $time - (86400 * 30);
$timeleft = $time - $limitMax;
$hourLeft = ceil($timeleft / 3600);
$dayLeft = ceil($timeleft / 86400);
$monthLeft = ceil($timeleft / (86400 * 30));
$yearLeft = ceil($timeleft / (86400 * 364));
$final = 31;
foreach ($range as $unit) {
switch ($unit) {
// case 'day':
// $final = $dayLeft;
// $timeAdd = 86400;
// break;
case 'month':
$final = $monthLeft;
$timeAdd = 86400 * 31;
break;
// case 'year':
// $final = $yearLeft;
// $timeAdd = 86400 * 364;
// break;
}
for ($i = 0; $i <= $final; $i++) {
$timeStart = $time - $i * $timeAdd;
$date = getDate($timeStart);
$dateFormat = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'];
$timeEnd = $time - ($i + 1) * $timeAdd;
$dateEnd = getDate($timeEnd);
$dateEndFormat = $dateEnd['year'] . '-' . $dateEnd['mon'] . '-' . $dateEnd['mday'];
$start = strtotime($dateFormat . ' 23:59:59');
$end = strtotime($dateEndFormat . ' 23:59:59');
if ($unit === 'day') {
$dateFormat = GetDate::in($start, 2, $this->doorGets->myLanguage);
} elseif ($unit === 'year') {
$dateFormat = ' ' . $date['year'];
} else {
$dateFormat = $date['mon'] . '-' . $date['year'];
}
$this->data['accounts'][$unit]["{$dateFormat}"] = $this->getAccounts($start, $end);
//$this->data['orders'][$unit]["$dateFormat"] = $this->getOrders($start,$end);
$this->data['comments'][$unit]["{$dateFormat}"] = $this->getComments($start, $end);
//$this->data['carts'][$unit]["$dateFormat"] = $this->getCarts($start,$end);
$this->data['contributions'][$unit]["{$dateFormat}"] = $this->getContributions($start, $end);
$this->data['tickets'][$unit]["{$dateFormat}"] = $this->getTickets($start, $end);
$this->data['cloud'][$unit]["{$dateFormat}"] = $this->getCloud($start, $end);
}
$this->data['accounts'][$unit] = array_reverse($this->data['accounts'][$unit]);
}
}
示例7: GetFormatDate
protected function GetFormatDate($date = null)
{
$dtn = null;
if (!isset($date)) {
$dtn = getDate();
} else {
$dtn = date('Y-m-d', $date / 1000);
}
return array($dtn['year'], $dtn['mday'], $dtn['mon'], 0, 0, 0);
}
示例8: run
public function run()
{
if ($this->sectionId !== null && isset($_POST['eventsCalendarWidgetDate']) && (!isset($_POST['eventsCalendarWidgetSectionId']) || $_POST['eventsCalendarWidgetSectionId'] != $this->sectionId)) {
return;
}
Yii::app()->clientScript->registerCssFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('event.assets'), false, -1, YII_DEBUG) . '/css/events-calendar-widget.css');
if (Yii::app()->request->isAjaxRequest && isset($_POST['eventsCalendarWidgetDate'])) {
$date = getdate(strtotime($_POST['eventsCalendarWidgetDate']));
} else {
$date = getdate();
}
$dateSqlStart = $date['year'] . '-' . str_pad($date['mon'], 2, '0', STR_PAD_LEFT) . '-01';
$nextMonth = getDate(mktime(0, 0, 0, $date['mon'] + 1, 1, $date['year']));
$dateSqlEnd = $date['year'] . '-' . str_pad($nextMonth['mon'], 2, '0', STR_PAD_LEFT) . '-01';
if ($this->sectionId !== null) {
$eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart AND t.section_id = :sectionId', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd, ':sectionId' => $this->sectionId)));
} else {
$eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd)));
}
$events = array();
foreach ($eventModels as $eventModel) {
$monthStart = substr($eventModel->date_start, 5, 2);
$yearStart = substr($eventModel->date_start, 0, 4);
$dayStart = substr($eventModel->date_start, 8, 2);
$dayEnd = substr($eventModel->date_end, 8, 2);
$monthEnd = substr($eventModel->date_end, 5, 2);
$yearEnd = substr($eventModel->date_end, 0, 4);
if ($monthStart == $monthEnd && $yearStart == $yearEnd) {
$dayEnd = substr($eventModel->date_end, 8, 2);
} elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthEnd && $date['year'] == $yearEnd)) {
$dayStart = 1;
} elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthStart && $date['year'] == $yearStart)) {
$dayEnd = 31;
} else {
$dayStart = 1;
$dayEnd = 31;
}
for ($i = (int) $dayStart; $i <= $dayEnd; $i++) {
if (!isset($events[$i])) {
$events[$i] = array();
}
$events[$i][] = $eventModel;
}
}
$render = $this->render('eventsCalendarWidget', array('events' => $events, 'date' => $date), true);
if (Yii::app()->request->isAjaxRequest) {
echo "\n" . '<div id="events-calendar-widget-render">' . "\n";
echo $render;
echo "\n" . '</div>' . "\n";
Yii::app()->end();
} else {
echo $render;
}
}
示例9: getBinary
/** Gets the DBF file as a binary string
* @see DBF::write()
* @return string a binary string containing the DBF file.
*/
public static function getBinary(array $schema, array $records, $pDate, $ismemofile)
{
if (is_numeric($pDate)) {
$date = getDate($pDate);
} elseif ($pDate == null) {
$date = getDate();
} else {
$date = $pDate;
}
return self::makeHeader($date, $schema, $records, $ismemofile) . self::makeSchema($schema) . self::makeRecords($schema, $records);
}
示例10: getWhatDay
/**
* @param bool $inFullName
* @return mixed
*/
public function getWhatDay($inFullName = true)
{
$typeKey = 'full';
if ($inFullName != true) {
$typeKey = 'abbr';
}
$this->dateInfoArray = @getDate();
$weekday = $this->dateInfoArray[self::KEY_WEEKDAY];
//曜日
return static::$nameOfhDays[$weekday][$typeKey];
}
示例11: get_server_time
function get_server_time()
{
$now = getDate();
if ($now["minutes"] < 10) {
$now["minutes"] = "0" . $now["minutes"];
}
if ($now["seconds"] < 10) {
$now["seconds"] = "0" . $now["seconds"];
}
echo $now["minutes"] . " " . $now["seconds"];
}
示例12: onLoad
public function onLoad($param)
{
parent::onLoad($param);
if (!$this->isPostBack) {
$date = getDate();
if (Prado::getApplication()->getSession()->contains('nonWorkingDayYear')) {
$this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
$this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
} else {
$this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
$this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
}
}
}
示例13: creatOrg
function creatOrg($org = null)
{
$this->org = $org;
$basepath = '/millersville/services/csil/organizations/profiles';
$sysname = $this->cleanAssetName($this->org['orgname']);
# Setup the structured data.
$this->_setupOfficerArray($this->org['officers']);
$this->_setupAdvisorArray($this->org['advisors']);
# Prepare the selected categories.
$temp = '';
if ($this->org['category']) {
foreach ($this->org['category'] as $cat) {
$temp .= '::CONTENT-XML-SELECTOR::' . str_replace('&', 'and', $cat);
}
}
$this->org['category'] = $temp;
$this->sData[] = array('type' => 'group', 'identifier' => 'about', 'structuredDataNodes' => array('structuredDataNode' => array(array('type' => 'text', 'identifier' => 'purpose', 'text' => $this->org['purpose']), array('type' => 'text', 'identifier' => 'category', 'text' => $this->org['category']), array('type' => 'text', 'identifier' => 'website', 'text' => $this->org['website'] != 'http://' ? $this->org['website'] : ''), array('type' => 'text', 'identifier' => 'displayWebsite', 'text' => $this->org['confidential'] == 'Y' ? 'Yes' : 'No'), array('type' => 'text', 'identifier' => 'numMembers', 'text' => $this->org['nummembers']), array('type' => 'group', 'identifier' => 'meetings', 'structuredDataNodes' => array('structuredDataNode' => array(array('type' => 'text', 'identifier' => 'day', 'text' => $this->org['day']), array('type' => 'text', 'identifier' => 'time', 'text' => $this->org['time']), array('type' => 'text', 'identifier' => 'location', 'text' => $this->org['location'])))))));
# Find the expiration date and folder.
#
# If the Month is after August, the expiration date needs to be the next year
# If the Month is August and the Day is greater than 20, the experiation date needs to be the next year
# If the Month is before August or August 20th, the expiration date needs to be the current year
#
$currentDate = getDate();
if ($currentDate['mon'] > 8 || $currentDate['mon'] == 8 && $currentDate['mday'] > 20) {
$expirationDate = mktime(0, 0, 0, 8, 20, $currentDate['year'] + 1);
$expirationFolder = $basepath . '/archived/' . $currentDate['year'] . '_' . ($currentDate['year'] + 1);
} else {
$expirationDate = mktime(0, 0, 0, 8, 20, $currentDate['year']);
$expirationFolder = $basepath . '/archived/' . ($currentDate['year'] - 1) . '_' . $currentDate['year'];
}
//echo $expirationFolder;
# Check to be sure the archived folder exists (i.e. archives/YYYY).
# If not, create the folder.
if (!$this->isAssetAlreadyCreated($expirationFolder, 'folder')) {
# Create the root public folder
$data = array('system-name' => str_replace($basepath . '/archived/', '', $expirationFolder), 'path' => $basepath . '/archived', 'indexable' => 0, 'publishable' => 0);
if (!$this->createFolder($data)) {
return false;
}
}
# Create the page.
$data = array('name' => $sysname, 'parentFolderPath' => $basepath . '/pending', 'shouldBePublished' => true, 'shouldBeIndexed' => true, 'expirationFolderPath' => $expirationFolder, 'metadata' => array('displayName' => $this->org['orgname'], 'title' => $this->org['orgname'], 'endDate' => $expirationDate), 'contentTypeId' => '5d9f032c7f000001000225f08612c787', 'structuredData' => array('structuredDataNodes' => array('structuredDataNode' => $this->sData)));
if (!$this->createPage($data)) {
return false;
}
unset($data);
return true;
}
示例14: publishNewHood
public function publishNewHood($hood)
{
$today = getDate();
$hood['date'] = $today['year'] . "-" . $today['mon'] . "-" . $today['mday'];
$hood['time'] = $today['hours'] . ":" . $today['minutes'] . ":" . $today['seconds'];
if (strlen($hood['text']) <= 500 && strlen($hood['text']) >= 1) {
$idHood = $this->hood_model->insertNewHood($hood);
$data['idHood'] = $idHood[0];
echo $this->session->userdata('id');
} else {
$data['error'] = 'Error el Hood debe contener entre 1 - 500 caracteres';
$data['main_content'] = '';
$this->load->view('includes/template', $data);
}
}
示例15: __construct
/**
*
* @param array $files Data table containing the name of data files
* @param array $datas Data table containing picked datas
* @param string $context_datas Will be written in the log files.
* @throws Exception Both arrays must have the same size.
*/
public function __construct($storage_directory, $datas, $context_datas)
{
$this->storage_directory = $storage_directory;
$this->week_suffix = "." . date("y") . '\'' . date("W");
$this->date = getDate();
$this->context_datas = $context_datas;
$this->files = array();
$this->data_file_name = $this->storage_directory . $this->data_file_name;
$this->datas = array();
foreach ($datas as $index => $data) {
$this->files[] = $this->storage_directory . $index;
$this->datas[] = $data;
}
$this->updateLogFiles();
}