本文整理汇总了PHP中Date函数的典型用法代码示例。如果您正苦于以下问题:PHP Date函数的具体用法?PHP Date怎么用?PHP Date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInsightForCounts
public function getInsightForCounts($this_period_count, $last_period_count, $instance, $matching_posts)
{
$insight = null;
if ($this_period_count > 0) {
$insight = new Insight();
$insight->slug = $this->getSlug();
$insight->instance_id = $instance->id;
$insight->date = $this->insight_date;
$network = ucfirst($instance->network);
$potential_headlines = array("The LOLs of %month", 'LOL activity detected');
$last_month = Date('F', strtotime(date('F') . " last month"));
$insight->text = 'Looks like ' . $this->username . ' found ' . number_format($this_period_count) . ' thing' . ($this_period_count == 1 ? '' : 's') . ' LOL-worthy in the last month.';
if ($this_period_count > $last_period_count && $last_period_count > 0) {
$potential_headlines[] = $network . ' must be getting even funnier!';
$lol_diff = $this_period_count - $last_period_count;
$insight->text .= ' That\'s ' . number_format($lol_diff) . ' more laugh' . ($lol_diff == 1 ? '' : 's') . ' than the ' . 'prior month.';
}
$insight->headline = $this->getVariableCopy($potential_headlines, array('other_user' => $matching_posts[0]->author_username, 'month' => $last_month));
$insight->filename = basename(__FILE__, ".php");
$insight->emphasis = Insight::EMPHASIS_MED;
if (count($this->posts_to_include) > 0) {
// Only include up to 10 posts to avoid InsightFieldExceedsMaxLengthException
$insight->setPosts(array_slice($this->posts_to_include, 0, 10));
}
}
return $insight;
}
示例2: private_core
protected function private_core()
{
$this->share_extension();
$this->cliente = FALSE;
$this->desde = Date('01-01-Y');
$this->hasta = Date('t-m-Y');
$this->resultados = FALSE;
$this->serie = new serie();
if (isset($_REQUEST['buscar_cliente'])) {
$this->buscar_cliente();
} else {
if (isset($_REQUEST['codcliente'])) {
$cli0 = new cliente();
$this->cliente = $cli0->get($_REQUEST['codcliente']);
if (isset($_REQUEST['codserie'])) {
$this->codserie = $_REQUEST['codserie'];
}
if (isset($_REQUEST['desde'])) {
$this->desde = $_REQUEST['desde'];
}
if (isset($_REQUEST['hasta'])) {
$this->hasta = $_REQUEST['hasta'];
}
if ($this->cliente) {
$this->resultados = $this->buscar_pedidos();
if (isset($_POST['cantidad_0'])) {
$this->agrupar_pedidos();
$this->resultados = FALSE;
}
}
}
}
}
示例3: run
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
$monday = Date('Y-m-d', strtotime('-2 days'));
$tuesday = Date('Y-m-d', strtotime('-1 days'));
\DB::table('shifts')->delete();
\DB::table('shifts')->insert(array(0 => array('id' => '1', 'eid' => '1', 'clockIn' => "{$monday} 08:00:00", 'clockOut' => "{$monday} 13:00:00", 'created_at' => '2015-05-26 08:04:58', 'updated_at' => '2015-05-26 12:51:33'), 1 => array('id' => '2', 'eid' => '1', 'clockIn' => "{$tuesday} 08:05:37", 'clockOut' => "{$tuesday} 17:02:57", 'created_at' => '2015-05-26 08:10:37', 'updated_at' => '2015-05-26 17:02:57'), 2 => array('id' => '3', 'eid' => '2', 'clockIn' => "{$tuesday} 08:22:32", 'clockOut' => "{$tuesday} 14:06:51", 'created_at' => '2015-05-26 08:22:32', 'updated_at' => '2015-05-26 14:06:51'), 3 => array('id' => '4', 'eid' => '2', 'clockIn' => "{$monday} 09:30:00", 'clockOut' => "{$monday} 16:18:27", 'created_at' => '2015-05-26 11:21:09', 'updated_at' => '2015-05-26 16:18:27'), 4 => array('id' => '5', 'eid' => '3', 'clockIn' => "{$monday} 11:38:57", 'clockOut' => "{$monday} 15:28:26", 'created_at' => '2015-05-26 11:38:57', 'updated_at' => '2015-05-26 15:28:26')));
}
示例4: DoSaveUserProfile
static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
{
$profileId = intval($profileId);
$arIDs = array();
if ($profileId > 0) {
$dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
$arProfile = $dbProfile->Fetch();
if (!$arProfile) {
$arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
return false;
}
if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
return false;
}
//if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
if (strlen($profileName) > 0) {
$arFields = array("NAME" => $profileName, "USER_ID" => $userId);
CSaleOrderUserProps::Update($profileId, $arFields);
}
$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
$arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
}
}
if (!is_array($orderProps)) {
$dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
$orderProps = array();
while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
$orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
}
}
$dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
$curVal = $orderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if (strlen($curVal) > 0) {
if ($profileId <= 0) {
if (strlen($profileName) <= 0) {
$profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
}
$arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
$profileId = CSaleOrderUserProps::Add($arFields);
}
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
$arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
$arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderUserPropsValue::Delete($id);
}
}
示例5: __construct
public function __construct($t = false)
{
parent::__construct('distribucion_ordenescarga_facturas', 'plugins/distribucion/');
if ($t) {
$this->idempresa = $t['idempresa'];
$this->codalmacen = $t['codalmacen'];
$this->idordencarga = $t['idordencarga'];
$this->idfactura = $t['idfactura'];
$this->idtransporte = $t['idtransporte'];
$this->fecha = $t['fecha'];
$this->usuario_creacion = $t['usuario_creacion'];
$this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion']));
$this->usuario_modificacion = $t['usuario_modificacion'];
$this->fecha_modificacion = Date('d-m-Y H:i');
} else {
$this->idempresa = null;
$this->codalmacen = null;
$this->idordencarga = null;
$this->idfactura = null;
$this->idtransporte = null;
$this->fecha = null;
$this->usuario_creacion = null;
$this->fecha_creacion = Date('d-m-Y H:i');
$this->usuario_modificacion = null;
$this->fecha_modificacion = null;
}
$this->factura_cliente = new factura_cliente();
$this->cliente = new cliente();
if (class_exists('ncf_rango')) {
$this->ncf_ventas = new ncf_ventas();
}
}
示例6: CONTROL_ORFEO
function CONTROL_ORFEO(&$db)
{
$this->cursor =& $db;
$this->db =& $db;
$this->fecha_hoy = Date("Y-m-d");
$this->sqlFechaHoy = $this->db->conn->OffsetDate(0, $this->db->conn->sysTimeStamp);
}
示例7: create_file
function create_file($source)
{
$new_date = Date("m-d-y");
$file = "json_dir/guardian_" . $new_date . ".json";
try {
if (file_exists($file)) {
throw new Exception("file exists ");
} else {
$new = touch($file);
if (!$new) {
throw new Exception("file not created");
exit(0);
}
//if
// else statement
$local_file = fopen($file, 'w');
if (fwrite($local_file, strlen($source), 998) == false) {
return false;
}
fclose($local_file);
$c_permissions = chmod($new, 0666);
}
//else
} catch (Exception $e) {
echo $e->getMessage();
}
return $file;
}
示例8: __construct
public function __construct($t = false)
{
parent::__construct('distribucion_lineastransporte', 'plugins/distribucion/');
if ($t) {
$this->idempresa = $t['idempresa'];
$this->codalmacen = $t['codalmacen'];
$this->idtransporte = $t['idtransporte'];
$this->fecha = $t['fecha'];
$this->referencia = $t['referencia'];
$this->cantidad = $t['cantidad'];
$this->importe = $t['importe'];
$this->peso = $t['peso'];
$this->estado = $this->str2bool($t['estado']);
$this->usuario_creacion = $t['usuario_creacion'];
$this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion']));
$this->usuario_modificacion = $t['usuario_modificacion'];
$this->fecha_modificacion = Date('d-m-Y H:i');
} else {
$this->idempresa = null;
$this->idtransporte = null;
$this->codalmacen = null;
$this->fecha = null;
$this->referencia = null;
$this->cantidad = null;
$this->importe = null;
$this->peso = null;
$this->estado = false;
$this->usuario_creacion = null;
$this->fecha_creacion = \Date('d-m-Y H:i');
$this->usuario_modificacion = null;
$this->fecha_modificacion = \Date('d-m-Y H:i');
}
$this->articulo = new articulo();
}
示例9: lihat_ujian
public function lihat_ujian()
{
if (Session::has('jurusan')) {
$tgl = Date('Y-m-d');
$jam = Date('H:i:s');
$jurusan = Session::get('jurusan');
$siswa = $this->getSiswa();
$ruang = Peserta::where('nis', $siswa->nis)->first();
$jadwal = DB::table('view_jadwal')->where('id_ruang', $ruang->id_ruang)->where('tgl_ujian', $tgl)->where('kode_jurusan', $jurusan)->get();
if (count($jadwal) > 0) {
foreach ($jadwal as $row) {
//jika jam mulai dan jam sekarang sama atau kurang setengah jam, maka tampilkan
if ($jam >= $row->jam && $jam <= $row->selesai) {
$adajadwal = Jadwal::find($row->id_jadwal);
return View('siswa.lihat_ujian')->with('jadwal', $adajadwal);
} else {
Session::flash('pesan', "Tidak ada Jadwal Ujian");
return Redirect::to('siswa');
}
}
} else {
Session::flash('pesan', "Tidak ada Jadwal Ujian");
return Redirect::to('siswa');
}
} else {
Session::flash('pesan', "Tidak ada Jadwal Ujian");
return Redirect::to('siswa');
}
}
示例10: __construct
public function __construct($t = false)
{
parent::__construct('distribucion_conductores', 'plugins/distribucion/');
if ($t) {
$this->id = $t['id'];
$this->idempresa = $t['idempresa'];
$this->codalmacen = $t['codalmacen'];
$this->codtrans = $t['codtrans'];
$this->nombre = $t['nombre'];
$this->licencia = $t['licencia'];
$this->tipolicencia = $t['tipolicencia'];
$this->idsubcuenta = $t['idsubcuenta'];
$this->codsubcuenta = $t['codsubcuenta'];
$this->estado = $this->str2bool($t['estado']);
$this->usuario_creacion = $t['usuario_creacion'];
$this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion']));
$this->usuario_modificacion = $t['usuario_modificacion'];
$this->fecha_modificacion = Date('d-m-Y H:i');
} else {
$this->id = null;
$this->idempresa = null;
$this->codalmacen = null;
$this->codtrans = null;
$this->nombre = null;
$this->licencia = null;
$this->tipolicencia = null;
$this->idsubcuenta = null;
$this->codsubcuenta = null;
$this->estado = false;
$this->usuario_creacion = null;
$this->fecha_creacion = Date('d-m-Y H:i');
$this->usuario_modificacion = null;
$this->fecha_modificacion = null;
}
}
示例11: addContentToNote
function addContentToNote($noteId, $gameId, $playerId, $mediaId, $type, $text, $title = '', $lat = 0, $lon = 0)
{
$text = addslashes($text);
if ($title == '') {
$title = Date('F jS Y h:i:s A');
} else {
$title = addslashes($title);
}
$query = "INSERT INTO note_content (note_id, game_id, media_id, type, text, title) VALUES ('{$noteId}', '{$gameId}', '{$mediaId}', '{$type}', '{$text}', '{$title}')";
$result = Module::query($query);
if (mysql_error()) {
return new returnData(1, NULL, mysql_error());
}
$contentId = mysql_insert_id();
Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM, $contentId, $lat, $lon);
if ($type == "PHOTO") {
Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_IMAGE, $contentId, $lat, $lon);
} else {
if ($type == "AUDIO") {
Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_AUDIO, $contentId, $lat, $lon);
} else {
if ($type == "VIDEO") {
Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_VIDEO, $contentId, $lat, $lon);
}
}
}
return new returnData(0, $contentId);
}
示例12: CetakPindahan
function CetakPindahan()
{
global $_lf;
$s = "select mps.*, mk.Nama as NamaMK\r\n from mhswpindahansetara mps\r\n left outer join mk mk on mps.MKID=mk.MKID\r\n where MhswPindahanID='{$_REQUEST['pin']}'\r\n order by mps.SetaraKode";
$r = _query($s);
$maxcol = 135;
$nmf = HOME_FOLDER . DS . "tmp/p.{$_SESSION['_Login']}.dwoprn";
$f = fopen($nmf, 'w');
fwrite($f, chr(27) . chr(15) . chr(27) . chr(108) . chr(20));
$div = str_pad('-', $maxcol, '-') . $_lf;
$n = 0;
$hal = 0;
$brs = 56;
$maxbrs = 49;
$dt = GetFields('mhswpindahan', 'MhswPindahanID', $_REQUEST['pin'], "Nama");
$prd = GetaField('prodi', 'ProdiID', $_REQUEST['prodi'], 'Nama');
$hdr = str_pad('*** DAFTAR PENYETARAAN MATA KULIAH PINDAHAN **', $maxcol, ' ', STR_PAD_BOTH) . $_lf . $_lf . $_lf;
$hdr .= "Tahun Akademik : " . NamaTahun($_REQUEST['tahun']) . $_lf;
$hdr .= "Prodi : {$prd}" . $_lf;
$hdr .= "Mahasiswa : {$dt['Nama']}" . $_lf;
$hdr .= $div;
$hdr .= str_pad("NO", 5) . str_pad("KODE", 10) . str_pad("MATA KULIAH", 35) . str_pad('SKS', 6) . str_pad('NILAI', 6) . str_pad('GRADE', 6) . str_pad('>>>', 5) . str_pad("KODE", 8) . str_pad("MATA KULIAH", 40) . str_pad('SKS', 6) . str_pad('GRADE', 4) . $_lf;
$hdr .= $div;
fwrite($f, $hdr);
while ($w = _fetch_array($r)) {
$n++;
fwrite($f, str_pad($n, 5) . str_pad($w['SetaraKode'], 10) . str_pad($w['SetaraNama'], 37) . str_pad($w['SetaraSKS'], 5) . str_pad($w['NilaiAkhir'], 7) . str_pad($w['SetaraGrade'], 4) . str_pad('>>>>', 5) . str_pad($w['MKKode'], 8) . str_pad($w['NamaMK'], 40) . str_pad($w['SKS'], 8) . str_pad($w['GradeNilai'], 4) . $_lf);
}
fwrite($f, $div);
fwrite($f, $_lf . "Dicetak Oleh : " . $_SESSION['_Login'] . ', ' . Date("d-m-Y H:i"));
fwrite($f, chr(12));
fclose($f);
TampilkanFileDWOPRN($nmf);
}
示例13: NewLinks
function NewLinks($newlinkshowdays)
{
global $ModPath, $ModStart, $links_DB;
include "header.php";
mainheader('nl');
$counter = 0;
$allweeklinks = 0;
while ($counter <= 7 - 1) {
$newlinkdayRaw = time() - 86400 * $counter;
$newlinkday = date("d-M-Y", $newlinkdayRaw);
$newlinkView = date("F d, Y", $newlinkdayRaw);
$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
$result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'");
$totallinks = sql_num_rows($result);
$counter++;
$allweeklinks = $allweeklinks + $totallinks;
}
$counter = 0;
$allmonthlinks = 0;
while ($counter <= 30 - 1) {
$newlinkdayRaw = time() - 86400 * $counter;
$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
$result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'");
$totallinks = sql_num_rows($result);
$allmonthlinks = $allmonthlinks + $totallinks;
$counter++;
}
echo '
<div class="card card-block">
<h3>' . translate("New links") . '</h3>
' . translate("Total new links: Last week") . ' : ' . $allweeklinks . ' -/- ' . translate("Last 30 days") . ' : ' . $allmonthlinks;
echo "<br />\n";
echo "<blockquote>" . translate("Show:") . " [<a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=7\" class=\"noir\">" . translate("week") . "</a>, <a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=14\" class=\"noir\">2 " . translate("weeks") . "</a>, <a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=30\" class=\"noir\">30 " . translate("days") . "</a>]</<blockquote>";
$counter = 0;
$allweeklinks = 0;
echo '
<blockquote>
<ul>';
while ($counter <= $newlinkshowdays - 1) {
$newlinkdayRaw = time() - 86400 * $counter;
$newlinkday = date("d-M-Y", $newlinkdayRaw);
$newlinkView = date(str_replace("%", "", translate("linksdatestring")), $newlinkdayRaw);
$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
$result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'");
$totallinks = sql_num_rows($result);
$counter++;
$allweeklinks = $allweeklinks + $totallinks;
if ($totallinks > 0) {
echo "<li><a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinksDate&selectdate={$newlinkdayRaw}\">{$newlinkView}</a> ( {$totallinks} )</li>";
}
}
echo '
</blockquote>
</ul>
</div>';
$counter = 0;
$allmonthlinks = 0;
include "footer.php";
}
示例14: import_sd_task
/**
* @param $date_begin
* @param $date_end
* @param $task_type
* @param $import_array
* @return bool
*/
function import_sd_task($date_begin, $date_end, $task_type, $import_array)
{
//var_dump($import_array);
$import_array['TITLE'] = iconv('UTF-8', 'cp1251', $import_array['TITLE']);
$import_array['DESCRIPTION'] = iconv('UTF-8', 'cp1251', $import_array['DESCRIPTION']);
$import_array['WORKORDERID'] = iconv('UTF-8', 'cp1251', $import_array['WORKORDERID']);
$data = array('nazva' => iconv('UTF-8', 'cp1251', "№") . $import_array['WORKORDERID'] . ' : ' . $import_array['TITLE'], 'vud' => $task_type, 'strateg' => 0, 'rezult' => $import_array['DESCRIPTION'], 'date_begin' => $date_begin, 'date_zapl_zaversh' => $date_end, 'zapl_chas' => 0, 'vlasnyk' => $this->session->userdata('user_id'), 'vykonavets' => $this->session->userdata('user_id'), 'mitky' => 0, 'date_end_povtor' => '', 'sd_task_id' => $import_array['WORKORDERID']);
if ($task_type == 3 and isset($import_array['OPERATIONTIME'])) {
$data['data_fakt'] = Date('Y-m-d', round($import_array['OPERATIONTIME'] / 1000));
}
$this->db->select('*');
$this->db->from('zavdannya');
$this->db->where('sd_task_id', $import_array['WORKORDERID']);
$this->db->where('date_begin', $date_begin);
$this->db->where('date_zapl_zaversh', $date_end);
$cheked = $this->db->get()->result_array();
if ($cheked) {
return 'Запис вже існує';
} else {
$res = $this->db->insert('zavdannya', $data);
if ($this->db->affected_rows() > 0) {
return true;
} else {
return false;
}
}
}
示例15: Listar
public function Listar($query = null)
{
$permissoes = listarAcesso();
try {
if ($query == null) {
$data = Date("Y-m-d");
$stmt = $this->p->query("SELECT nome, id FROM " . MYSQL_BASE_EMPRESAS . " WHERE ativo='S' ORDER BY id DESC");
$confirm = "return confirm('Deseja remover esse registro?');";
foreach ($stmt as $item) {
echo '<tr>';
echo ' <td>' . $item['nome'] . '</td>';
echo ' <td>';
if (in_array(224, $permissoes)) {
echo '<a class="btn btn-info" href="edit.php?id=' . $item['id'] . '">';
echo ' <i class="icon-edit icon-white"></i> Editar';
echo ' </a>';
}
if (in_array(225, $permissoes)) {
echo ' <a class="btn btn-danger" onclick="' . $confirm . '" href="index.php?cmd=del&id=' . $item['id'] . '">';
echo ' <i class="icon-trash icon-white"></i> Deletar';
echo ' </a>';
}
echo ' </td>';
echo '</tr>';
}
} else {
$stmt = $this->p->query($query);
}
$this->p = null;
return $stmt;
} catch (PDOException $ex) {
echo "Erro: " . $ex->getMessage();
}
}