Ejemplo n.º 1
0
 /**
  * @param $value
  * @return boolean
  */
 public function validate($value)
 {
     if ($this->isEmpty($value)) {
         return true;
     }
     if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value) && $value == Gpf_Common_DateUtils::getDate(strtotime($value))) {
         return true;
     }
     return false;
 }
 private function updatePlannedTaskParams() {
     $plannedTask = new Gpf_Db_PlannedTask();
     $plannedTask->setClassName(Pap_Merchants_Config_EmailNotificationsFormBase::REPORTS_SEND_CLASS);
     $plannedTask->setAccountId($this->task->getAccountId());
     try {
         $plannedTask->loadFromData(array(Gpf_Db_Table_PlannedTasks::CLASSNAME, Gpf_Db_Table_PlannedTasks::ACCOUNTID));
         $plannedTask->setParams($this->getSerializedDateParams(Gpf_Common_DateUtils::getDate($this->time)));
         $plannedTask->setLastPlanDate(Gpf_Common_DateUtils::addDateUnit(Gpf_Common_DateUtils::getDate($this->time), 1, Gpf_Common_DateUtils::DAY));
         $plannedTask->save();
     } catch (Gpf_Exception $e) {
         Gpf_Log::error('Error during updating planned ReportsSendTask: ' . $e->getMessage());
     }
 }
Ejemplo n.º 3
0
 public static function transformToMonthEnd($date)
 {
     $timestamp = Gpf_Common_DateUtils::getTimestamp($date);
     $newdate = mktime(0, 0, 0, date("m", $timestamp), Gpf_Common_DateUtils::getDaysInMonth(date("m", $timestamp), date("Y", $timestamp)), date("Y", $timestamp));
     return Gpf_Common_DateUtils::getDate($newdate);
 }
	private function formatTransactionDate($created){
		$createdStamp = Gpf_Common_DateUtils::getTimeStamp($created);
		$datetime = new Gpf_DateTime();
		$today = $datetime->getDayStart();
		$yesterday = $datetime->getDayStart();
		$yesterday->addDay(-1);

		if($createdStamp >= $today->toTimeStamp()){
			return $this->_("today");
		}
		if($createdStamp >= $yesterday->toTimeStamp()){
			return $this->_("yesterday");
		}
		return Gpf_Common_DateUtils::getDate($createdStamp);
	}