Green text with current time
@param string $s
514638
public static function nfoTime($s)
    {
        self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'info');
    }
271924
public static function clearDate($ts = null)
	{
		// default to now
		if ($ts === null) $ts = sfDateTimeToolkit::now();
		
		list($H, $i, $s, $m, $d, $Y) = sfDateTimeToolkit::breakdown($ts);
		
		return mktime($H, $i, $s, 0, 0, 0);
	}
1242086
public function lastActiveReadable()
    {
        return ($this->lastActive == '0000-00-00 00:00:00' || $this->lastActive == null ? 'Never' : date('F jS, Y \a\t h:ia', strtotime($this->lastActive)));
    }
895099
public static function dateTextNow($hasTime=true,$hasMicroseconds=false)
	{
		$tmpDate = new DateTime();
		if ($hasTime) {
			return $tmpDate->format(($hasMicroseconds!==false) ? self::$dateTimeMicroFormat : self::$dateTimeFormat);
		}  else {
			return $tmpDate->format(self::$dateFormat);
		}
	}
113676
protected function nicetime($value) {
        if (!$value) {
            return '';
        } else if ($value > mktime(0, 0, 0, date('m'), date('d'), date('Y'))) {
            return 'Today ' . date('g:i a', $value);
        } else if ($value > mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'))) {
            return 'Yesterday ' . date('g:i a', $value);
        } else {
            return date('jS F Y, g:i a', $value);
        }
    }
339904
public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text)
    {
        //lastWrittenPercent and lastWrittenTime are used to prevent performance issues if
        //many progresses are written. (the filesystem access at nfs can slow that down)
        //we just update the progressbar if the percentage increases and
        //the last request was at least 500ms ago
        if (!$this->_lastWrittenPercent) {
            $this->_lastWrittenPercent = (int)($percent*100);
        }
        if (!$this->_lastWrittenTime) {
            $this->_lastWrittenTime = microtime(true);
        }
        if ($this->_lastWrittenPercent < (int)($percent*100)
            && $this->_lastWrittenTime+0.5 <= microtime(true)) {
            $arguments = array(
                'current'       => $current,
                'max'           => $max,
                'percent'       => ($percent * 100),
                'timeTaken'     => $timeTaken,
                'timeRemaining' => $timeRemaining,
                'text'          => $text,
                'finished'      => false
            );
            $this->_saveStatus($arguments);
            $this->_lastWrittenPercent = (int)($percent*100);
            $this->_lastWrittenTime = microtime(true);
        }
    }
370514
public function setStatus($s){
        if (is_string($s) && $s){
            if ($s == 'WORKING' || $s == 'SHIPPED' || $s == 'CANCELLED'){
                $this->options['InboundShipmentHeader.ShipmentStatus'] = $s;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
64808
private function timeAgo($timestamp) {
    $now = new \DateTime('now');
    $date = new \DateTime();
    $date->setTimestamp($timestamp);
    $datediff = date_diff($now, $date);
    $message = '';
    $components = [
      ['y', 'year', 'years'], ['m', 'month', 'months'],
      ['d', 'day', 'days'], ['h', 'hour', 'hours'],
      ['i', 'minute', 'minutes'], ['s', 'second', 'seconds'],
    ];
    foreach ($components as $component) {
      if ($datediff->{$component[0]} > 0) {
        $message = $datediff->{$component[0]} . ' '
          . ($datediff->{$component[0]} > 1 ? t($component[2]) : $component[1]);
        break;
      }
    }
    return !empty($message) ? $message . ' ' . t('ago') : '';
  }
1226753
static function noAccents($s)
	{
		$s = str_replace(array('É', 'È', 'Ë', 'Ê'), 'E', $s);
		$s = str_replace(array('À', 'Ä', 'Â'), 'A', $s);
		$s = str_replace(array('Ï', 'Î'), 'I', $s);
		$s = str_replace(array('Ö', 'Ô'), 'O', $s);
		$s = str_replace(array('Ù', 'Ü' ,'Û'), 'U', $s);
		$s = str_replace('Ç', 'C', $s);
	
		$s = str_replace(array('é', 'è', 'ë', 'ê'), 'e', $s);
		$s = str_replace(array('à', 'ä', 'â'), 'a', $s);
		$s = str_replace(array('ï', 'î'), 'i', $s);
		$s = str_replace(array('ö', 'ô'), 'o', $s);
		$s = str_replace(array('ù', 'ü', 'û'), 'u', $s);
		$s = str_replace('ç', 'c', $s);
	
		return $s;
	}
190220
public function timeToText($time, $milliseconds = false)
    {
        $sign = "";
        if ($time < 0) {
            $sign = "-";
        }
        $time = abs($time);
        $cent = str_pad(($time % 1000), 3, '0', STR_PAD_LEFT);
        $time = floor($time / 1000);
        $sec = str_pad($time % 60, 2, '0', STR_PAD_LEFT);
        $min = str_pad(floor($time / 60), 2, '0', STR_PAD_LEFT);
        $hour = str_pad(floor($time / 60 / 60), 1, '0');

        $textTime = $min.':'.$sec;
        if (floor($time / 60 / 60) > 0) {
            $textTime = $hour."'".$textTime;
        }

        if ($milliseconds) {
            $textTime = $textTime.'.'.$cent;
        }

        return $sign.$textTime;
    }
1335255
public function convertTime($timestamp)
    {
        if (!$timestamp instanceof \GMP) {
            $timestamp = gmp_init($timestamp);
        }

        $timestamp = gmp_sub($timestamp, gmp_init('122192928000000000'));
        $d = gmp_init('10000000');
        list($q, $r) = gmp_div_qr($timestamp, $d);

        //If $r >= $d/2, we have to round up
        $sign = gmp_sign(gmp_sub($d, gmp_add($r, $r)));
        if ($sign <= 0) {
            $q = gmp_add($q, gmp_init(1));
        }

        return gmp_strval($q);
    }
934593
protected function onSetText(string $text): void
    {
        parent::onSetText($text);

        $this->isInvalid = false;
        $this->value = null;

        if ($this->hasError()) {
            return;
        }

        if ($this->isEmpty()) {
            return;
        }

        if (!preg_match('/^[-+]?[0-9]+$/', $text)) {
            $this->setError('Invalid value');
            $this->isInvalid = true;

            return;
        }

        $value = intval($text);

        if ($this->minimumValue !== null && $value < $this->minimumValue || $this->maximumValue !== null && $value > $this->maximumValue) {
            $this->setError('Invalid value');
            $this->isInvalid = true;

            return;
        }

        $this->value = $value;
    }
1285560
public function format_date($field)
    {
        if (!$this->current_row[$field]) {
            $this->current_row[$field] = '-';
        } else {
            if (is_object($this->current_row[$field])) {
                $this->current_row[$field] = $this->current_row[$field]->format(
                    $this->app->getConfig('locale/date', 'd/m/Y')
                );

            } else {
                $this->current_row[$field] = date(
                    $this->app->getConfig('locale/date', 'd/m/Y'),
                    strtotime($this->current_row[$field])
                );
            }
        }
    }
1008218
public static function strtotime($str, $time = null)
    {
        if (is_null($time)) {
            $time = self::time();
        }

        return strtotime($str, $time);
    }
16621
public function setCurrentTime(): self
	{
		return $this->modifyClone()->setTime((int) date('H'), (int) date('i'), (int) date('s'));
	}
935852
private function quoteApplicationVersion($s) {
	    $quotedString = $this->collapseWhitespace($s);
	    $quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
	    $quotedString = preg_replace('/\\(/', '\\(', $quotedString);
	
	    return $quotedString;
    }
901138
public function formatTime($time)
    {
        $time = preg_match('~\D~', $time) ? strtotime($time) : $time;

        return time() - $time;
    }