Get current year.

@param bool   $inUTC
@param string $format

@return int
334369
public static function getCurrentYear($inUTC = false, $format = self::YEAR_FORMAT_LONG)
    {
        $tz = $inUTC ? 'UTC' : null;

        return (int) static::now($tz)->format($format);
    }
1194738
public static function firstDayOfYear($year = null, $format = 'Y-m-d')
    {
        $year = $year ? $year : date('Y');
        return date($format, mktime(0, 0, 0, 1, 1, $year));
    }
408091
public function getYear($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('Y', $timestamp);
    }
111801
public function getYear(Getter $getter, int $year) {
        $this->addTime(3*60);
        $ufs = $getter->get($year);
		if (!$ufs) {
			return false;
		}

        foreach ($ufs as $date => $value) {
			$f = Carbon::parse($date, config('app.timezone'));
			$uf = \Model::factory(UF::class)->where('fecha', $f->format('Y-m-d'))->findOne();
			if (!$uf) {
				$uf = \Model::factory(UF::class)->create();
				$uf->fecha = $f;
				$uf->valor = $value;
				$uf->save();
			}
		}
		return true;
	}
323899
public function getDate($date = null, $format = 'Y-m-d H:i:s')
    {
        if (strlen($date) < 0) {
            $date = date('d-m-Y H:i:s');
        }

        $timeStamp = new DateTime($date);
        return $timeStamp->format($format);
    }
305438
public static function getCurrentMonth($inUTC = false)
    {
        $tz = $inUTC ? 'UTC' : null;

        return (int) static::now($tz)->format('n');
    }
634054
public function getIp($format = self::FORMAT_HEX)
    {
        if ($this->ipHex === null) {
            return null;
        } elseif ($format === self::FORMAT_HEX) {
            return $this->ipHex;
        } elseif ($format === self::FORMAT_IP_STRING) {
            return inet_ntop($this->hex2bin($this->ipHex));
        }
        throw new \Exception('Invalid IP format');
    }
151142
public function getSort($format = 'native')
    {
        if (!is_null($this->suppliedSort)) {
            $nativeSort = $this->suppliedSort;
        } elseif (!is_null($this->entitySort)) {
            $nativeSort = $this->entitySort;
        } else {
            // no explicit sort supplied, return false
            return false;
        }

        // convert to sql dialect if asked
        if ($format == 'sql') {
            // first_name,-last_name
            $sortFields = explode(',', $nativeSort);
            $parsedSorts = array(); // the final Phalcon friendly sort array

            foreach ($sortFields as $order) {
                if (substr($order, 0, 1) == '-') {
                    $subOrder = substr($order, 1);
                    if (!empty($subOrder)) {
                        $parsedSorts[] = $subOrder . " DESC";
                    }
                } else {
                    $parsedSorts[] = $order;
                }
            }
            $nativeSort = implode(',', $parsedSorts);
        }

        return $nativeSort;
    }
941196
public static function getTemplate($template, $format = 'html5')
	{
		$templates = static::getTemplates($template, $format = 'html5');

		return isset($templates[0]) ? $templates[0] : null;
	}
516750
public function now($format = null)
    {
        $date = $this->currentDate
            ? clone $this->currentDate
            : ($this->currentDate = new \DateTime())
        ;

        return empty($format) ?
            $date :
            $date->format($format)
        ;
    }
726207
public function get($input_value, $input_format, $output_format = 'Y-m-d H:i:s')
    {
        $utc_offset = $this->dic['utc_offset'];

        if ($utc_offset == 0) {
            return $this->dic['datetimenow'];
        }

        $dt = Carbon::createFromFormat($input_format, $input_value);

        if ($utc_offset > 0) {
            $dt->subMinutes($utc_offset);
        } else {
            $dt->addMinutes($utc_offset);
        }

        return $dt->format($output_format);
    }
1266842
protected function getDateTimeWithOptionalFormat($format, $value)
    {
        if ($date = DateTime::createFromFormat('!'.$format, $value)) {
            return $date;
        }

        return $this->getDateTime($value);
    }
1087450
public function getTime(string $format = null)
    {
        $time = $this->time + $this->offset;

        if (!is_null($format)) {
            return date($format, $time);
        }

        return $time;
    }
218900
public function getDateMonday($format = 'Y-m-d')
    {
        $weekDay = $this->format('N') - 1;
        $dateTime = clone $this;
        if ($weekDay) {
            $dateTime->add(sprintf('- %d days', $weekDay));
        }
        if ($format) {
            return $dateTime->format($format);
        }
        return $dateTime;
    }
1003731
public function getId($format = 'bytes')
    {
        return static::isUuid() && $format != false ? uuid($format, $this->id) : $this->id;
    }
409145
static function get_animal($birth_year, $format = '1')
    {
        //1900年是子鼠年
        if ($format == '2')
        {
            $animal = array('子鼠', '丑牛', '寅虎', '卯兔', '辰龙', '巳蛇', '午马', '未羊', '申猴', '酉鸡', '戌狗', '亥猪');
        }
        elseif ($format == '1')
        {
            $animal = array('鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪');
        }
        $my_animal = ($birth_year - 1900) % 12;
        return $animal[$my_animal];
    }
636255
protected function date($format){

		$timestamp = $this->getTimestamp();
		
	    list($gYear, $gMonth, $gDay, $gWeek) = explode('-', date('Y-m-d-w', $timestamp));
	    list($pYear, $pMonth, $pDay) = static::getJalali($gYear, $gMonth, $gDay);
	    $pWeek = ($gWeek + 1);

	    if ($pWeek >= 7) {
	        $pWeek = 0;
	    }

	    if ($format == '\\') {
	        $format = '//';
	    }

	    $lenghFormat = strlen($format);
	    $i = 0;
	    $result = '';

	    while ($i < $lenghFormat) {
	        $par = $format{$i};
	        if ($par == '\\') {
	            $result .= $format{ ++$i};
	            $i ++;
	            continue;
	        }
	        switch ($par) {
	            # Day
	            case 'd':
	                $result .= sprintf('%02s', $pDay);
	                break;

	            case 'D':
	                $result .= substr(static::$dayWeek[$pWeek], 0, 2);
	                break;

	            case 'j':
	                $result .= $pDay;
	                break;

	            case 'l':
	                $result .= static::$dayWeek[$pWeek];
	                break;

	            case 'N':
	                $result .= $pWeek + 1;
	                break;

	            case 'w':
	                $result .= $pWeek;
	                break;

	            case 'z':
	                $result .= $this->daysYear($pMonth, $pDay);
	                break;

	            case 'S':
	                $result .= self::NUMBER_TH;
	                break;

	            # Week
	            case 'W':
	                $result .= ceil($this->daysYear($pMonth, $pDay) / 7);
	                break;

	            # Month
	            case 'F':
	                $result .= static::$monthYear[$pMonth-1];
	                break;

	            case 'm':
	                $result .= sprintf('%02s', $pMonth);
	                break;

	            case 'M':
	                $result .= substr(static::$monthYear[$pMonth-1], 0, 6);
	                break;

	            case 'n':
	                $result .= $pMonth;
	                break;

	            case 't':
	                $result .= static::isLeapYear($pYear) && ($pMonth == 12) ? 30 : static::$daysMonthJalali[intval($pMonth)-1];
	                break;

	            # Years
	            case 'L':
	                $result .= intval($this->isLeapYear($pYear));
	                break;

	            case 'Y':
	            case 'o':
	                $result .= $pYear;
	                break;

	            case 'y':
	                $result .= substr($pYear, 2);
	                break;

	            # Time
	            case 'a':
	            case 'A':
	                if (date('a', $timestamp) == 'am') {
	                    $result .= (($par == 'a') ? self::AM : self::ANTE_MERIDIEM);
	                } else {
	                    $result .= (($par == 'a') ? self::PM : self::POST_MERIDIEM);
	                }
	                break;

	            case 'B':
	            case 'g':
	            case 'G':
	            case 'h':
	            case 'H':
	            case 's':
	            case 'u':
	            case 'i':
	            # Timezone
	            case 'e':
	            case 'I':
	            case 'O':
	            case 'P':
	            case 'T':
	            case 'Z':
	                $result .= date($par, $timestamp);
	                break;

	            # Full Date/Time
	            case 'c':
	                $result .= ($pYear . '-' . $pMonth . '-' . $pDay . ' ' . date('H:i:s P', $timestamp));
	                break;

	            case 'r':
	                $result .= (substr(static::$dayWeek[$pWeek], 0, 2) . '، ' . $pDay . ' ' . substr(static::$monthYear[$pMonth], 0, 6) . ' ' . $pYear . ' ' . date('H:i:s P', $timestamp));
	                break;

	            case 'U':
	                $result .= $timestamp;
	                break;

	            default:
	                $result .= $par;
	        }
	        $i ++;
	    }

	    return $result;
	}