本文整理汇总了PHP中date_timestamp_set函数的典型用法代码示例。如果您正苦于以下问题:PHP date_timestamp_set函数的具体用法?PHP date_timestamp_set怎么用?PHP date_timestamp_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_timestamp_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_content
/**
* Generate content of the block
*
* @global type $DB
* @global type $USER
* @return type
*/
public function get_content()
{
global $CFG, $DB, $USER;
require_once $CFG->dirroot . '/blocks/obu_forms/lib.php';
require_once $CFG->dirroot . '/blocks/obu_forms/dbquery.php';
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass();
$this->content->text = '';
$form_list = '';
$authorisations = get_authorisations($USER->id);
foreach ($authorisations as $authorisation) {
$date = date_create();
date_timestamp_set($date, $authorisation->request_date);
$request_date = date_format($date, "d-m-y H:i");
// If the authorisation is overdue, show visual alert (bold text)
$elapsed_days = (time() - $authorisation->request_date) / 86400;
if ($elapsed_days >= get_config('block_obu_forms', 'alertdays')) {
$form_list .= "<span style='font-weight:bold'>" . $request_date . "</span>";
} else {
$form_list .= $request_date;
}
$data = $DB->get_record('local_obu_forms_data', array('id' => $authorisation->data_id), '*', MUST_EXIST);
$template = $DB->get_record('local_obu_forms_templates', array('id' => $data->template_id), '*', MUST_EXIST);
$form = $DB->get_record('local_obu_forms', array('id' => $template->form_id), '*', MUST_EXIST);
$form_list .= ' ' . html_writer::link('/local/obu_forms/process.php?id=' . $authorisation->data_id, $form->formref, array("style" => "color:red"));
$form_list .= "<br>";
}
if ($form_list) {
$form_list = "<p><b>" . get_string('requireauthorisation', 'block_obu_forms') . "</b></p>" . $form_list;
$this->content->text .= $form_list;
}
return $this->content;
}
示例2: __construct
public function __construct($path, $rootPath, $size, $createdAt, $modifiedAt)
{
$this->path = $path;
$this->rootPath = rtrim(is_null($rootPath) ? '' : $rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$this->size = $size;
$this->createdAt = is_numeric($createdAt) ? date_timestamp_set(new \DateTime(), $createdAt) : clone $createdAt;
$this->modifiedAt = is_numeric($modifiedAt) ? date_timestamp_set(new \DateTime(), $modifiedAt) : clone $modifiedAt;
$this->relativePath = null;
}
示例3: __construct
public function __construct($sourceName, $value, $currencyCode, $rateType, $date, $baseCurrencyCode, $createdAt = null, $modifiedAt = null)
{
$this->sourceName = $sourceName;
$this->value = $value;
$this->currencyCode = CurrencyCodeUtil::clean($currencyCode);
$this->rateType = $rateType;
$this->baseCurrencyCode = CurrencyCodeUtil::clean($baseCurrencyCode);
$processDate = function ($arg) {
$arg = is_null($arg) ? new \DateTime('now') : $arg;
return is_numeric($arg) ? date_timestamp_set(new \DateTime(), $arg) : clone $arg;
};
$this->date = $processDate($date);
$this->createdAt = $processDate($createdAt);
$this->modifiedAt = $processDate($modifiedAt);
}
示例4: checkGameDates
static function checkGameDates(&$message)
{
if (APIHelpers::$FHQSESSION != NULL) {
if (!isset(APIHelpers::$FHQSESSION['game'])) {
$message = 'Select game please';
return false;
}
} else {
if (!isset($_SESSION['game'])) {
$message = 'Select game please';
return false;
}
}
if (APISecurity::isAdmin() || APISecurity::isTester()) {
return true;
}
$date_start = new DateTime();
date_timestamp_set($date_start, strtotime($_SESSION['game']['date_start']));
$date_stop = new DateTime();
date_timestamp_set($date_stop, strtotime($_SESSION['game']['date_stop']));
$date_restart = new DateTime();
date_timestamp_set($date_restart, strtotime($_SESSION['game']['date_restart']));
$date_current = new DateTime();
date_timestamp_set($date_current, time());
$di_start = $date_current->diff($date_start);
$di_stop = $date_current->diff($date_stop);
$di_restart = $date_current->diff($date_restart);
$bWillBeStarted = $di_start->invert == 0;
$bWillBeRestarted = $di_stop->invert == 1 && $di_restart->invert == 0;
// echo date_diff($date_current, $date_start)."<br>";
if ($bWillBeStarted || $bWillBeRestarted) {
$label = $bWillBeStarted ? 'Game will be started after: ' : 'Game will be restarted after: ';
$di = $bWillBeStarted ? $di_start : $di_restart;
$message = $label . '<br>
<div class="fhq_timer" id="days">' . $di->d . '</div> day(s)
<div class="fhq_timer" id="hours">' . $di->h . '</div> hour(s)
<div class="fhq_timer" id="minutes">' . $di->i . '</div> minute(s)
<div class="fhq_timer" id="seconds">' . $di->s . '</div> second(s)<br>
<div id="reload_content" onclick="startTimer();"/></div> <br><br>
';
return false;
}
return true;
}
示例5: reserve
function reserve($equipment, $owner, $color, $start, $end)
{
$message = '';
$eventsPage = wire("pages")->get("name=event");
$startdate = date_create();
date_timestamp_set($startdate, intval($start));
$enddate = date_create();
date_timestamp_set($enddate, intval($end));
if (!validateFormat($startdate, $enddate)) {
return;
}
$startTS = date_timestamp_get($startdate);
$endTS = date_timestamp_get($enddate);
// Reservation Rules
if (!validateAdvanceTime($startTS)) {
return;
}
if (!validateDuration($start, $end)) {
return;
}
if (!validateEventOverlap($equipment, $start, $end)) {
return;
}
if (!validateAccumulatedTime($startTS, $endTS)) {
return;
}
// All rules passed, make event
$newevent = new Page();
$newevent->template = wire('templates')->get("name=event");
$newevent->title = $owner . " " . $equipment . " " . $start;
$newevent->username = $owner;
$newevent->equipment_name = $equipment;
$newevent->color = $color;
$newevent->start_time = $start;
$newevent->end_time = $end;
$newevent->parent = $eventsPage;
$newevent->save();
$message .= "<p class='message'>Reservation Scheduled</p>";
wire("session")->redirect($page->path);
//reload page
return;
}
示例6: change
public function change($ptime)
{
$date = date_create();
date_timestamp_set($date, strtotime($ptime));
$a = date_format($date, 'Y-m-d H:i:s');
date_default_timezone_set("Asia/Ulaanbaatar");
$b = date("Y-m-d H:i:s");
$etime = strtotime($b) - strtotime($a);
if ($etime < 1) {
return '0 seconds';
}
$a = array(365 * 24 * 60 * 60 => 'жил', 30 * 24 * 60 * 60 => 'сар', 24 * 60 * 60 => 'өдөр', 60 * 60 => 'цаг', 60 => 'минут', 1 => 'секунт');
$a_plural = array('жил' => 'жилийн', 'сар' => 'сарын', 'өдөр' => 'өдрийн', 'цаг' => 'цагийн', 'минут' => 'минутын', 'секунт' => 'секунтын');
foreach ($a as $secs => $str) {
$d = $etime / $secs;
if ($d >= 1) {
$r = round($d);
return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' өмнө';
}
}
}
示例7: date_default_timezone_get
<?php
$dftz021 = date_default_timezone_get();
//UTC
$dtms021 = array();
date_timestamp_set($dtms021, 123456789);
示例8: DateTime
<script src="../signature-pad/jquery.signaturepad.js"></script>
<script src="sample-signature-output.js"></script>
<table>
<?php
$dsn = "mysql:host=localhost;dbname=receipt";
$user = "receipt";
$pass = "xfQQEqZEDzXpcG6a";
$date = new DateTime();
// 4. Open a connection to the database using PDO
$db = new PDO($dsn, $user, $pass);
// Make sure we are talking to the database in UTF-8
$db->exec('SET NAMES utf8');
// Create some other pieces of information about the user
// to confirm the legitimacy of their signature
// 5. Use PDO prepare to insert all the information into the database
$sql = 'select id,signature,signator,ip,created from signatures order by created';
foreach ($db->query($sql) as $row) {
print "<tr>";
print "<td><a href=signature.php?id=" . $row['id'] . ">" . $row['signator'] . "</td>";
//print "<td>".$row['signator'] . "</td>";
print "<td>" . $row['ip'] . "</td>";
date_timestamp_set($date, $row['created']);
print "<td>" . date_format($date, 'Y-m-d H:i:s') . "</td>";
print "</tr>";
}
?>
</table>
<script src="../assets/json2.min.js"></script>
</body>
示例9: foreach
<?php
if (is_array($comments)) {
?>
<div class='comments'>
<p>Kommentarer</p>
<?php
foreach ($comments as $id => $comment) {
if (!empty($comment['name']) || !empty($comment['content'])) {
?>
<?php
$date = date_create();
date_timestamp_set($date, $comment['timestamp']);
$dateis = date_format($date, 'Y-m-d H:i') . "\n";
?>
<div class='comment'>
<p class='name'>
<?php
if (!empty($comment['web'])) {
?>
<a href='http://<?php
echo $comment['web'];
?>
'><?php
echo $comment['name'];
示例10: supplement_display
function supplement_display($form, $fields)
{
$fld_start = '<input ';
$fld_start_len = strlen($fld_start);
$fld_end = '>';
$fld_end_len = strlen($fld_end);
$offset = 0;
$date_format = 'd-m-y';
do {
$pos = strpos($form->template, $fld_start, $offset);
if ($pos === false) {
break;
}
if ($pos > $offset) {
$this->_form->addElement('html', substr($form->template, $offset, $pos - $offset));
// output any HTML
}
$offset = $pos + $fld_start_len;
$pos = strpos($form->template, $fld_end, $offset);
if ($pos === false) {
break;
}
$element = split_input_field(substr($form->template, $offset, $pos - $offset));
$offset = $pos + $fld_end_len;
$text = $fields[$element['id']];
if ($element['type'] == 'checkbox') {
// map a checkbox value to a nice character
if ($text == '1') {
$text = '✔';
} else {
$text = '';
}
}
if ($element['type'] == 'date' && $text) {
// map a UNIX date to a nice text string
$date = date_create();
date_timestamp_set($date, $text);
$text = date_format($date, $date_format);
}
if ($element['type'] == 'file' && $text) {
// map a file pathname hash to a URL for the file
$text = get_file_link($text);
}
$this->_form->addElement('static', $element['id'], $element['value'], $text);
} while (true);
$this->_form->addElement('html', substr($form->template, $offset));
// output any remaining HTML
return;
}
示例11: session_start
<?php
session_start();
if (!isset($_SESSION['NAME'])) {
header('Location: ../index.php');
echo "Some thing wrong with session";
}
$conn = null;
require_once '../../../connections/Connection.php';
$UnityId = $_SESSION['NAME'];
$checkoutDay = $_REQUEST['checkoutDate'];
$from_time = strtotime($checkoutDay);
$date = date_create();
date_format($date, 'm-d-Y');
$checkoutDateUSA = date_format(date_timestamp_set($date, $from_time), 'd/M/Y h:i:s A');
$check_if_friday_sql = "SELECT TO_CHAR(CAST('{$checkoutDateUSA}' AS TIMESTAMP),'D') as DAY from dual";
var_dump($check_if_friday_sql);
$stid = oci_parse($conn, $check_if_friday_sql);
oci_execute($stid);
oci_fetch_all($stid, $check_if_friday_result, null, null, OCI_FETCHSTATEMENT_BY_ROW);
if ($check_if_friday_result[0]['DAY'] != 6) {
echo "Checkouts are allowed only on Fridays. Select the checkout date for a Friday.";
echo "<td><a href=\"ReserveCamera.php\">Back to Date Selection</a></td>";
} else {
echo "startDateTime " . $checkoutDateUSA . "\n";
echo "<br><br>";
$selectRoomQuery = "SELECT DISTINCT c.\"ID\",c.\"MAKE\",c.\"MODEL\",c.\"LENS_CONFIGURATION\",c.\"MEMORY\",c.\"LOCATION\"\r\n\t\t\t\t\t FROM CAMERA c\r\n\t\t\t\t\t WHERE c.\"ID\" NOT IN \r\n\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\tSELECT cq.\"ID\" FROM CAMERA_QUEUE cq\r\n\t\t\t\t\t\t\t\t\tWHERE cq.\"UnityId\" = '{$UnityId}'\r\n\t\t\t\t\t\t\t\t\tAND cq.\"DateOfQueue\" = '{$checkoutDateUSA}'\r\n\t\t\t\t\t\t\t\t\tUNION\r\n\t\t\t\t\t\t\t\t\tSELECT cc.\"ID\" from CAMERA_CHECKOUT cc\r\n\t\t\t\t\t\t\t\t\tWHERE cc.\"UnityId\" = '{$UnityId}'\r\n\t\t\t\t\t\t\t\t\tAND cc.\"ReturnDate\" > SYSTIMESTAMP\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t";
var_dump($selectRoomQuery);
$stid = oci_parse($conn, $selectRoomQuery);
$result = oci_execute($stid);
echo "<table border='1'>\r\n\t<tr>\r\n\t<th> CAMERA ID </th>\r\n\t<th> MAKE </th>\r\n\t<th> MODEL </th>\r\n\t<th> LENS_CONFIGURATION </th>\r\n\t<th> MEMORY </th>\r\n\t<th> LOCATION </th>\t\t\r\n\t<th> Actions </th>\r\n\t</tr>";
示例12: getExpireTime
/**
* Returns the expiration timestamp.
*
* @param int $lifetime
*
* @return int
* @codeCoverageIgnore
*/
public function getExpireTime($lifetime = null, $bypass_control = false)
{
$expire = parent::getExpireTime($lifetime, $bypass_control);
return 0 === $expire ? null : date_timestamp_set(new \DateTime(), $expire);
}
示例13: get_content
//.........这里部分代码省略.........
$name = html_writer::tag('td', $link, null);
$grade = html_writer::tag('td', number_format($entry->grade, 1) . " / " . number_format($assignment->grade, 1), $style);
$gradedassignmentsoutput .= html_writer::tag('tr', $name . $grade, $displaynone);
}
if ($overflow) {
$linktext = '<b>' . get_string('more', 'block_assignments') . '</b>';
$href = new moodle_url('/blocks/assignments/view.php');
$class = 'btn-show-all btn-show-all-right';
$linkinhead = html_writer::tag('a', $linktext, array('class' => $class, 'href' => $href));
}
}
$this->content->text .= html_writer::start_tag('div', array('class' => 'row-fluid'));
$this->content->text .= html_writer::start_tag('div', array('class' => 'span6'));
$class = 'table table-responsive table-striped table-hover table-bordered';
$this->content->text .= html_writer::start_tag('table', array('id' => 'graded-assign', 'class' => $class));
$thname = html_writer::tag('th', get_string('graded', 'block_assignments') . $linkinhead, array('colspan' => '2'));
$this->content->text .= html_writer::tag('thead', $thname);
$this->content->text .= $gradedassignmentsoutput;
$this->content->text .= html_writer::end_tag('table');
$linkinhead = '';
$openassignmentsoutput = '';
$overflow = false;
if (empty($assignments)) {
$openassignmentsoutput .= block_assignments_no_data_row(2);
} else {
usort($assignments, 'block_assignments_due_more_recent');
$counter = 0;
$rowcounter = 0;
foreach ($assignments as $assignment) {
$counter++;
$course = $courses[$assignment->course];
if (!in_array($assignment->id, $gradedassignments)) {
$datedue = date_create();
date_timestamp_set($datedue, $assignment->duedate);
$datenow = date_create('NOW');
$duein = date_diff($datenow, $datedue);
$due = $duein->format('%R%a');
if ($due < +0) {
if ($counter == count($assignments)) {
$openassignmentsoutput .= block_assignments_no_data_row(2);
}
continue;
} else {
if ($due == +0) {
$due = $duein->format('%H:%I');
if ($due == +1) {
$due = substr($due, 1) . " " . get_string('hour', 'block_assignments');
} else {
$due = substr($due, 1) . " " . get_string('hours', 'block_assignments');
}
} else {
if ($due == +1) {
$due = substr($due, 1) . " " . get_string('day', 'block_assignments');
} else {
$due = substr($due, 1) . " " . get_string('days', 'block_assignments');
}
}
}
$due = get_string('until', 'block_assignments') . " " . $due;
$rowcounter++;
$course = $courses[$assignment->course];
$displaynone = null;
if ($rowcounter > 5) {
$displaynone = array('style' => 'display: none;');
$overflow = true;
}
示例14: date_timestamp_set
<?php
if (isset($_POST['seleksi'])) {
include_once 'config/koneksi.php';
date_timestamp_set("Asia/Jakarta");
//proses pemindahan datacalon siswa ke data siswa
$tahunsekarang = date('y');
$quota = $mysqli->query("SELECT * FROM mvp_kuota order by kuota_id desc limit 1");
$kuota = $quota->fetch_object();
$query = $mysqli->query("SELECT * From mvp_user, mvp_calon_siswa where mvp_user.user_id=mvp_calon_siswa.user_id and mvp_calon_siswa.nilai_un>={$kuota->passing_grade} and LEFT(mvp_calon_siswa.no_formulir, 2)='{$tahunsekarang}' order by mvp_calon_siswa.nilai_un desc limit {$kuota->kuota}");
$querytidakditerima = $mysqli->query("SELECT * From mvp_user, mvp_calon_siswa where mvp_user.user_id=mvp_calon_siswa.user_id and mvp_calon_siswa.nilai_un<'{$kuota->passing_grade}' and LEFT(mvp_calon_siswa.no_formulir, 2)='{$tahunsekarang}' order by mvp_calon_siswa.nilai_un desc");
while ($data = $query->fetch_object()) {
$ubah = $mysqli->query("UPDATE mvp_calon_siswa set diterima='1' where user_id='{$data->user_id}'");
$cari = $mysqli->query("SELECT user_id from mvp_siswa where user_id='{$data->user_id}'");
$ketemu = $cari->num_rows;
if ($ketemu == 0) {
$proses = $mysqli->query("INSERT INTO mvp_siswa values('','{$data->user_id}','{$data->nisn}','{$data->tempatlahir}','{$data->tanggallahir}','{$data->jk}','{$data->goldar}','{$data->telprumah}','{$data->provinsi}','{$data->kota}','{$data->kecamatan}','{$data->kodepos}','{$data->alamat}','{$data->status}','{$data->tahunkelulusan}','{$data->no_skhun}','{$data->nilai_un}','{$data->no_formulir}','1',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'0')");
}
}
//untuk yang tidak diterima
while ($data = $querytidakditerima->fetch_object()) {
$cari1 = $mysqli->query("SELECT user_id from mvp_siswa where user_id='{$data->user_id}'");
$ketemu1 = $cari->num_rows;
if ($ketemu1 == 0) {
$proses1 = $mysqli->query("INSERT INTO mvp_siswa values('','{$data->user_id}','{$data->nisn}','{$data->tempatlahir}','{$data->tanggallahir}','{$data->jk}','{$data->goldar}','{$data->telprumah}','{$data->provinsi}','{$data->kota}','{$data->kecamatan}','{$data->kodepos}','{$data->alamat}','{$data->status}','{$data->tahunkelulusan}','{$data->no_skhun}','{$data->nilai_un}','{$data->no_formulir}','0',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'0')");
}
}
//akumulasi data yang sudah diterima dan tidak
$cariditerima = $mysqli->query("SELECT mvp_user.user_id from mvp_siswa, mvp_user where mvp_siswa.diterima=1 and mvp_user.user_id=mvp_siswa.user_id and LEFT(mvp_siswa.no_formulir, 2)='{$tahunsekarang}'");
$caritidakditerima = $mysqli->query("SELECT mvp_user.user_id from mvp_siswa, mvp_user where mvp_siswa.diterima=0 and mvp_user.user_id=mvp_siswa.user_id and LEFT(mvp_siswa.no_formulir, 2)='{$tahunsekarang}'");
$diterima = $cariditerima->num_rows;
示例15: date_default_timezone_get
<?php
$dftz021 = date_default_timezone_get();
//UTC
$dtms021 = new DateTime();
$wrong_parameter = array();
date_timestamp_set($dtms021, $wrong_parameter);