本文整理汇总了PHP中date_create函数的典型用法代码示例。如果您正苦于以下问题:PHP date_create函数的具体用法?PHP date_create怎么用?PHP date_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: umur
function umur($tgl_lahir)
{
$thn_lahir = date_format(date_create($tgl_lahir), 'Y');
$thn_skrg = date('Y');
$umur = $thn_skrg - $thn_lahir;
return $umur;
}
示例2: detalleOrden
public function detalleOrden($codigo, $parametro)
{
$o_LTesoreria = new LTesoreria();
$o_LPersona = new LPersona();
$combo = $this->comboTipoDocumento('1');
$arrayDatos = $o_LTesoreria->datosPersonales($codigo, $parametro);
//$codigo='';
$nombre = '';
$fechaNacimiento = '';
$edad = '';
$documento = '';
$filiacion = '';
//print_r($arrayDatos);
foreach ($arrayDatos as $fila) {
//$codigo=$fila[0];
$nombre = htmlentities($fila[4] . " " . $fila[5] . ", " . $fila[6]);
$fechaNacimiento = $fila[7];
$documento = $fila[0];
$filiacion = $fila[3];
}
//date_default_timezone_set('Europe/London');
$datetime = date_create($fechaNacimiento);
$fechaNacimiento = date_format($datetime, 'm/d/Y');
//echo date_format($datetime, DATE_ATOM);
//echo $fechaNacimiento->format('d-m-y');
//print_r($arrayDatos);
$edad = $o_LPersona->formatoEdad($fechaNacimiento);
//creando la tabla
$arrayFilas = $o_LTesoreria->obtenerOrdenes($codigo, $parametro);
$arrayTipo = array("10" => "h", "0" => "c", "1" => "c", "2" => "c", "11" => "h", "3" => "c", "13" => "h", "4" => "c", "5" => "c", "6" => "c", "12" => "c", "7" => "c");
$arraycabecera = array("10" => " ", "0" => "Nro Orden", "1" => "Fecha", "2" => "Filiación", "11" => " ", "3" => "concepto", "13" => "Nro Comp.", "4" => "Precio", "5" => "Cant.", "6" => "Total", "12" => "....", "7" => "es");
$arrayColorEstado = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9");
$o_Html = new Tabla1($arraycabecera, 15, $arrayFilas, 'tablaOrden', 'filax', 'filay', 'filaSeleccionada', 'onClick', '', 5, $arrayTipo, 7, $arrayColorEstado);
require_once "../../cvista/tesoreria/detalleOrden.php";
}
示例3: __construct
/**
* __construct Contructor that prepare the collection for assign product list
* @var Int $userId Current logged seller id
* @var String $filter Search query string
* @var String $filter_prostatus product status query string
* @var String filter_data_frm product creation from date query string
* @var String filter_data_to product creation to date query string
* @var Object $collection Catalog product collection object
* @var Array $products Catalog product ids
* @var Object $collection Assign product collection object
*/
public function __construct()
{
parent::__construct();
$userId = Mage::getSingleton('customer/session')->getCustomerId();
$filter = $this->getRequest()->getParam('s') != "" ? $this->getRequest()->getParam('s') : "";
$filter_prostatus = $this->getRequest()->getParam('prostatus') != "" ? $this->getRequest()->getParam('prostatus') : "";
$filter_data_frm = $this->getRequest()->getParam('from_date') != "" ? $this->getRequest()->getParam('from_date') : "";
$filter_data_to = $this->getRequest()->getParam('to_date') != "" ? $this->getRequest()->getParam('to_date') : "";
$from = null;
$to = null;
if ($filter_data_to) {
$todate = date_create($filter_data_to);
$to = date_format($todate, 'Y-m-d H:i:s');
}
if ($filter_data_frm) {
$fromdate = date_create($filter_data_frm);
$from = date_format($fromdate, 'Y-m-d H:i:s');
}
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('name', array('like' => "%" . $filter . "%"))->setOrder('entity_id', 'AESC');
$products = array();
foreach ($collection as $data) {
array_push($products, $data->getEntityId());
}
$collection = Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()->addFieldToFilter('product_id', array('in' => $products))->addFieldToFilter('created_at', array('datetime' => true, 'from' => $from, 'to' => $to))->addFieldToFilter('seller_id', array('eq' => $userId));
if ($filter_prostatus != "") {
$collection->addFieldToFilter('flag', array('eq' => $filter_prostatus));
}
$this->setCollection($collection);
}
示例4: dateDiff
function dateDiff($s, $t)
{
$datetime1 = date_create($s);
$datetime2 = date_create($t);
$interval = date_diff($datetime1, $datetime2);
return $interval->format('%R%a days');
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$a = new \App\Popups();
$a->judul = Input::get('judul');
$a->slug = str_slug(Input::get('judul'));
$a->deskripsi = Input::get('keterangan');
$a->tipe_valid = Input::get('type_valid');
if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_date") {
$a->date_valid_start = date_format(date_create(Input::get('date_valid_start')), "Y-m-d");
$a->date_valid_end = date_format(date_create(Input::get('date_valid_end')), "Y-m-d");
}
if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_time") {
$a->time_valid_start = date_format(date_create(Input::get('time_valid_start')), "H:i:s");
$a->time_valid_end = date_format(date_create(Input::get('time_valid_end')), "H:i:s");
}
if (Input::hasFile('image') and Input::file('image')->isValid()) {
$image = date("YmdHis") . uniqid() . "." . Input::file('image')->getClientOriginalExtension();
Input::file('image')->move(storage_path() . '/popup_image', $image);
$a->image = $image;
}
$a->keep_open = Input::get('keep_open');
$a->hotlink = Input::get('hotlink');
$a->idpengguna = Auth::user()->id;
$a->save();
return redirect(url('admin/popups'));
}
示例6: __construct
public function __construct($id = NULL, $name = NULL, $surname = NULL, $birthdate = NULL)
{
$this->id = $id;
$this->name = $name;
$this->surname = $surname;
$this->birthdate = date_create($birthdate);
}
示例7: testGetDatetimeObject
public function testGetDatetimeObject()
{
$this->assertEquals(date_create('2 months ago'), $this->helper->getDatetimeObject('2 months ago'));
$this->assertEquals(date_create('now'), $this->helper->getDatetimeObject(time()));
$this->assertEquals(date_create('now'), $this->helper->getDatetimeObject());
$this->assertEquals(date_create('now'), $this->helper->getDatetimeObject(null));
}
示例8: populateDogodekSplosni
/**
*
* @param type $manager
* @param type $v
*/
public function populateDogodekSplosni($manager, $v)
{
$rep = $manager->getRepository('Koledar\\Entity\\DogodekSplosni');
$o = null;
$nov = false;
if (!$o) {
$o = new \Koledar\Entity\DogodekSplosni();
$nov = true;
}
$o->setTitle($v[1]);
$o->setStatus($v[2]);
$date = empty($v[3]) ? null : date_create($v[3]);
$o->setZacetek($date);
$date = empty($v[4]) ? null : date_create($v[4]);
$o->setKonec($date);
$ref = $v[5] ? $this->getReference($v[5]) : null;
$o->setProstor($ref);
$ref = $v[6] ? $this->getReference($v[6]) : null;
// $o->setSezona($ref);
if ($nov) {
$rep->create($o);
} else {
$rep->update($o);
}
$referenca = 'DogodekSplosni-' . $v[0];
// var_dump($referenca);
$this->addReference($referenca, $o);
$referencaDog = 'DogodekSpl-' . $v[0];
$this->addReference($referencaDog, $o->getDogodek());
}
示例9: currentDateTime
private function currentDateTime()
{
date_default_timezone_set("Asia/Colombo");
$date = date_create();
$current_time = date_format($date, 'Y-m-d H:i:s');
return $current_time;
}
示例10: getTimeDifference
public function getTimeDifference($otherDate)
{
$date1Timestamp = date_create($this->dayOfBirth);
$date2Timestamp = date_create($otherDate);
$diff = date_diff($date1Timestamp, $date2Timestamp);
return $diff;
}
示例11: monthIntegerToString
/**
* @param integer $monthInteger
* @param string $format
* @return bool|string
*/
public static function monthIntegerToString($monthInteger, $format = 'F')
{
if (is_string($monthInteger) && in_array(strtolower($monthInteger), self::$months)) {
return $monthInteger;
}
return date_format(date_create("1/{$monthInteger}/2000"), $format);
}
示例12: composeBirthday
private function composeBirthday()
{
extract($this->properties);
$day -= $day > 40 ? 40 : 0;
$month -= $month > 40 ? 40 : 0;
return date_create("{$century}{$year}-{$month}-{$day}");
}
示例13: __construct
public function __construct()
{
$this->idgroup = intval($this->idgroup);
$this->groupmainactivity = intval($this->groupmainactivity);
$this->groupcreatedate = date_create($this->groupcreatedate);
$this->groupcreatoruserid = intval($this->groupcreatoruserid);
}
示例14: createNinjaInvoice
private function createNinjaInvoice($publicId, $account, $client)
{
$invoice = new Invoice();
$invoice->account_id = $account->id;
$invoice->user_id = $account->users()->first()->id;
$invoice->public_id = $publicId;
$invoice->client_id = $client->id;
$invoice->invoice_number = $account->getNextInvoiceNumber();
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->amount = PRO_PLAN_PRICE;
$invoice->balance = PRO_PLAN_PRICE;
$invoice->save();
$item = new InvoiceItem();
$item->account_id = $account->id;
$item->user_id = $account->users()->first()->id;
$item->public_id = $publicId;
$item->qty = 1;
$item->cost = PRO_PLAN_PRICE;
$item->notes = trans('texts.pro_plan_description');
$item->product_key = trans('texts.pro_plan_product');
$invoice->invoice_items()->save($item);
$invitation = new Invitation();
$invitation->account_id = $account->id;
$invitation->user_id = $account->users()->first()->id;
$invitation->public_id = $publicId;
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $client->contacts()->first()->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
return $invitation;
}
示例15: age
public function age()
{
$bd = $this->patient->getOriginal('dateOfBirth');
$diagDate = $this->schedule->getOriginal('diagDate');
$age = date_diff(date_create($bd), date_create($diagDate))->y;
return $age . ' ปี';
}