本文整理汇总了PHP中CMbDT::dateFromLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbDT::dateFromLocale方法的具体用法?PHP CMbDT::dateFromLocale怎么用?PHP CMbDT::dateFromLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbDT
的用法示例。
在下文中一共展示了CMbDT::dateFromLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsePeremptionDate
/**
* Parse a date trying most date formats
*
* @param string $date Raw date
* @param bool $alt Alternate semantic in some cases
*
* @return string ISO date equivalent
*/
static function parsePeremptionDate($date, $alt = false)
{
// dates du type 18304 >> octobre 2018 (304 = jour dans l'année)
// YYYY-MM-DD
if (preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $date)) {
return $date;
}
// DD/MM/YYYY
if (preg_match('/^\\d{2}\\/\\d{2}\\/\\d{4}$/', $date)) {
return CMbDT::dateFromLocale($date);
}
// YYYYMM
if (preg_match('/^(20\\d{2})(\\d{2})$/', $date, $parts)) {
$date = CMbDT::date("+1 MONTH", $parts[1] . "-" . $parts[2] . "-01");
return CMbDT::date("-1 DAY", $date);
}
// YYMMDD
if (preg_match('/^(\\d{2})(\\d{2})(\\d{2})$/', $date, $parts)) {
if ($alt) {
$date = CMbDT::date("+1 MONTH", "20" . $parts[3] . "-" . $parts[1] . "-01");
} else {
$date = CMbDT::date("+1 MONTH", "20" . $parts[1] . "-" . $parts[2] . "-01");
}
return CMbDT::date("-1 DAY", $date);
}
// YYNNN
if (preg_match('/^(\\d{2})(\\d{3})$/', $date, $parts)) {
$date = CMbDT::date("+{$parts[2]} DAYS", "20{$parts[1]}-01-01");
return CMbDT::date("-1 DAY", $date);
}
// MMYY
if (preg_match('/^(\\d{2})(\\d{2})$/', $date, $parts)) {
$date = CMbDT::date("+1 MONTH", "20" . $parts[2] . "-" . $parts[1] . "-01");
return CMbDT::date("-1 DAY", $date);
}
return null;
}
示例2: trim
//first line
//cleanup line 1 to 13
for ($a = $fl; $a < $fl + 12; $a++) {
$lines[$a] = trim($lines[$a]);
}
//init
$ipp = $lines[$fl];
$nom = $lines[$fl + 1];
$prenom = $lines[$fl + 2];
$addr = $lines[$fl + 3];
$addr_2 = $lines[$fl + 4];
$cp_ville = $lines[$fl + 5];
$naissance = CMbDT::dateFromLocale($lines[$fl + 6]);
$codeSecu = $lines[$fl + 6];
$nda = $lines[$fl + 8];
$date = CMbDT::dateTime(CMbDT::dateFromLocale($lines[$fl + 9]));
$codeCores = $lines[$fl + 10];
$codePresc = $lines[$fl + 11];
//IPP
if ($lines[$fl] != '') {
$patient->_IPP = $ipp;
$patient->loadFromIPP();
}
//search
if (!$patient->_id && $nom != '' && $prenom != "") {
$where = array();
$where[] = "`nom` LIKE '{$nom}%' OR `nom_jeune_fille` LIKE '{$nom}%'";
$where["prenom"] = "LIKE '{$prenom}%' ";
$where["naissance"] = "LIKE '{$naissance}' ";
$patient->loadObject($where);
}
示例3: updatePlainFields
/**
* @see parent::updatePlainFields()
*/
function updatePlainFields()
{
parent::updatePlainFields();
$soundex2 = new soundex2();
$anonyme = is_numeric($this->nom);
if ($this->nom) {
$this->nom = self::applyModeIdentitoVigilance($this->nom, false, null, $anonyme);
$this->nom_soundex2 = $soundex2->build($this->nom);
}
if ($this->nom_jeune_fille) {
$this->nom_jeune_fille = self::applyModeIdentitoVigilance($this->nom_jeune_fille, false, null, $anonyme);
$this->nomjf_soundex2 = $soundex2->build($this->nom_jeune_fille);
}
if ($this->prenom) {
$this->prenom = self::applyModeIdentitoVigilance($this->prenom, true, null, $anonyme);
$this->prenom_soundex2 = $soundex2->build($this->prenom);
}
if ($this->cp === "00000") {
$this->cp = "";
}
if ($this->assure_nom) {
$this->assure_nom = self::applyModeIdentitoVigilance($this->assure_nom);
}
if ($this->assure_nom_jeune_fille) {
$this->assure_nom_jeune_fille = self::applyModeIdentitoVigilance($this->assure_nom_jeune_fille);
}
if ($this->assure_prenom) {
$this->assure_prenom = self::applyModeIdentitoVigilance($this->assure_prenom, true);
}
if ($this->assure_cp === "00000") {
$this->assure_cp = "";
}
if ($this->_pays_naissance_insee) {
$this->pays_naissance_insee = $this->updatePatNumPaysInsee($this->_pays_naissance_insee);
}
if ($this->pays) {
$this->pays_insee = $this->updatePatNumPaysInsee($this->pays);
}
if ($this->_assure_pays_naissance_insee) {
$this->assure_pays_naissance_insee = $this->updatePatNumPaysInsee($this->_assure_pays_naissance_insee);
}
if ($this->assure_pays) {
$this->assure_pays_insee = $this->updatePatNumPaysInsee($this->assure_pays);
}
// Détermine la civilité du patient automatiquement (utile en cas d'import)
// Ne pas vérifier que la civilité est null (utilisation de updatePlainField dans le loadmatching)
$this->completeField("civilite");
if ($this->civilite === "guess") {
$this->naissance = CMbDT::dateFromLocale($this->naissance);
$this->evalAge();
$this->civilite = $this->_annees < CAppUI::conf("dPpatients CPatient adult_age") ? "enf" : ($this->sexe === "m" ? "m" : "mme");
}
// Détermine la civilité de l'assure automatiquement (utile en cas d'import)
$this->completeField("assure_civilite");
if ($this->assure_civilite === "guess") {
$this->assure_naissance = CMbDT::dateFromLocale($this->assure_naissance);
$this->evalAgeAssure();
$sexe = $this->assure_sexe ? $this->assure_sexe : $this->sexe;
$this->assure_civilite = $this->_age_assure < CAppUI::conf("dPpatients CPatient adult_age") ? "enf" : ($sexe === "m" ? "m" : "mme");
}
}
示例4: array
// WHERE s.service_id = '$service_id' => le service_id est pas notNull (en config)
if (isset($display_stat["prevu"])) {
$serie = array("data" => array(), "label" => utf8_encode("Prévu"), "markers" => array("show" => true));
foreach ($dates as $key => $_date) {
$date = CMbDT::dateFromLocale($_date[1]);
$query = "SELECT count(sejour_id) as nb_prevu\n FROM sejour\n WHERE entree <= '{$date} 00:00:00' AND sortie >= '{$date} 00:00:00'\n AND service_id = '{$service_id}'";
$prevu_count = $ds->loadResult($query);
$serie["data"][] = array(count($serie["data"]) - 0.1, $prevu_count, isset($lits_ouverts_par_date[$date]) && $lits_ouverts_par_date[$date] != 0 ? $prevu_count / $lits_ouverts_par_date[$date] : 0);
}
$series[] = $serie;
}
// Réel (affectations)
if (isset($display_stat["reel"])) {
$serie = array("data" => array(), "label" => utf8_encode("Réel"), "markers" => array("show" => true));
foreach ($dates as $key => $_date) {
$date = CMbDT::dateFromLocale($_date[1]);
$query = "SELECT count(affectation_id) as nb_reel\n FROM affectation d\n WHERE entree <= '{$date} 00:00:00' AND sortie >= '{$date} 00:00:00'\n AND service_id = '{$service_id}'";
$reel_count = $ds->loadResult($query);
$serie["data"][] = array(count($serie['data']) + 0.1, $reel_count, isset($lits_ouverts_par_date[$date]) && $lits_ouverts_par_date[$date] != 0 ? $reel_count / $lits_ouverts_par_date[$date] : 0);
}
$series[] = $serie;
}
// Entrées dans la journée (nb de placements sur tous les lits sur chaque journée)
// Ne pas compter les blocages
if (isset($display_stat["entree"])) {
$query = "SELECT d.date, count(affectation_id) as entrees\n FROM {$tab_name} d\n LEFT JOIN affectation a ON\n DATE_FORMAT(a.entree, '%Y-%m-%d') <= d.date AND DATE_FORMAT(a.sortie, '%Y-%m-%d') >= d.date\n AND a.sejour_id != 0 AND a.service_id = '{$service_id}'\n GROUP BY d.date\n ORDER BY d.date";
$entrees_journee = $ds->loadList($query);
$serie = array("data" => array(), "label" => utf8_encode("Entrées"), "markers" => array("show" => true));
foreach ($entrees_journee as $_entrees_by_day) {
$serie["data"][] = array(count($serie['data']) + 0.3, $_entrees_by_day["entrees"], isset($lits_ouverts_par_date[$_entrees_by_day["date"]]) && $lits_ouverts_par_date[$_entrees_by_day["date"]] != 0 ? $_entrees_by_day["entrees"] / $lits_ouverts_par_date[$_entrees_by_day["date"]] : 0);
}