Php вывести часовой пояс

Как вывести время с учётом часового пояса в PHP

Иногда требуется сделать такой сайт, на котором время будет подстраиваться под часовой пояс пользователя. Задача эта непростая в том плане, что определить часовой пояс пользователя проблемно. Поэтому выводят в 99% случаев время, соответствующее серверному часовому поясу. Но давайте с Вами разберём, как всё-таки можно вывести время с учётом временной зоны конкретного пользователя.

Как я уже написал, определить часовой пояс пользователя сложно, об этом мы поговорим в следующей статье. А пока что будем считать, что мы уже знаем временное смещение относительно серверного времени.

Лучше всего будет поставить серверное время по Гринвичу. И сохранять надо все данные со временем именно по Гринвичу. Я уже когда-то писал, что хранить надо в той же базе данных не строковый формат даты и времени, а числовой, то есть тот, который возвращается функцией time().

Давайте с Вами разберём небольшой код:

Примерно так и работает вывод времени с учётом часового пояса пользователя на PHP. Безусловно, можно и не ставить по умолчанию время по Гринвичу, а узнавать смещение относительно серверного времени. Впрочем, о смещении мы с Вами поговорим в следующей статье.

Копирование материалов разрешается только с указанием автора (Михаил Русаков) и индексируемой прямой ссылкой на сайт (http://myrusakov.ru)!

Добавляйтесь ко мне в друзья ВКонтакте: http://vk.com/myrusakov.
Если Вы хотите дать оценку мне и моей работе, то напишите её в моей группе: http://vk.com/rusakovmy.

Если Вы не хотите пропустить новые материалы на сайте,
то Вы можете подписаться на обновления: Подписаться на обновления

Если у Вас остались какие-либо вопросы, либо у Вас есть желание высказаться по поводу этой статьи, то Вы можете оставить свой комментарий внизу страницы.

Порекомендуйте эту статью друзьям:

Если Вам понравился сайт, то разместите ссылку на него (у себя на сайте, на форуме, в контакте):

Она выглядит вот так:

  • BB-код ссылки для форумов (например, можете поставить её в подписи):
  • Комментарии ( 5 ):

    получается, что когда у нас переводится время +-1час летом и зимой, то придется два раза в год вручную менять значение $offset . я правильно понял?

    если таким скриптом,то да.можно функцию смены написать по дате

    а можно немного поподробнее? 🙂 можно эту ф-ию в студию? а то я уже больше месяца не могу до конца разобраться с этими ф-иями даты и времени.

    к сожалению в студию нельзя — её надо писать) суть я объяснил) условием проверяете дату и,если совпадает с нужной — переводите время

    Для добавления комментариев надо войти в систему.
    Если Вы ещё не зарегистрированы на сайте, то сначала зарегистрируйтесь.

    Copyright © 2010-2021 Русаков Михаил Юрьевич. Все права защищены.

    Источник

    date_default_timezone_get

    (PHP 5 >= 5.1.0, PHP 7, PHP 8)

    date_default_timezone_get — Возвращает часовой пояс, используемый по умолчанию всеми функциями даты/времени в скрипте

    Описание

    Функция пытается получить часовой пояс по умолчанию по порядку следующими способами:

    Чтение настройки часового пояса с помощью функции date_default_timezone_set() (если применимо)

    Чтение значения ini-настройки date.timezone (если задана)

    Если используется этот метод (все предыдущие не дали результата), будет выдано предупреждение. Не стоит полагаться на результат, полученный этим способом, вместо этого лучше задать в параметрах часового пояса date.timezone правильное значение.

    Если ни один из способов не принёс результата, date_default_timezone_get() вернёт часовой пояс UTC .

    Список параметров

    У этой функции нет параметров.

    Возвращаемые значения

    Возвращает строку ( string ).

    Примеры

    Пример #1 Получение часового пояса по умолчанию

    if ( date_default_timezone_get ()) <
    echo ‘date_default_timezone_set: ‘ . date_default_timezone_get () . ‘
    ‘ ;
    >

    if ( ini_get ( ‘date.timezone’ )) <
    echo ‘date.timezone: ‘ . ini_get ( ‘date.timezone’ );
    >

    Результатом выполнения данного примера будет что-то подобное:

    Пример #2 Получение аббревиатуры часового пояса

    Результат выполнения данного примера:

    Смотрите также

    User Contributed Notes 9 notes

    Please note that on Debian/Ubuntu this function will return the system timezone defined in /etc/localtime if date.timezone is not defined, even with PHP 5.4+

    In my case, I’m not sure I can guess the correct timezone any better than PHP and it’s no where near important enough to nag the user, so.

    // Suppress DateTime warnings
    date_default_timezone_set (@ date_default_timezone_get ());
    ?>

    This function is not very useful for getting the OS timezone. One way to do it is to look at the results of ‘timedatectl’ from the OS. You can also look at the link from /etc/localtime

    >file /etc/localtime
    /etc/localtime: symbolic link to /usr/share/zoneinfo/America/Los_Angeles

    >timedatectl
    Local time: Thu 2020-12-24 07:11:27 PST
    Universal time: Thu 2020-12-24 15:11:27 UTC
    RTC time: Thu 2020-12-24 15:11:27
    Time zone: America/Los_Angeles (PST, -0800)
    System clock synchronized: yes
    NTP service: active
    RTC in local TZ: no

    = trim ( shell_exec ( «timedatectl | grep -i zone: 2>/dev/null» ));
    $dateinfoarray = explode ( ‘ ‘ , $dateinfo );
    echo ‘Timezone = ‘ . $dateinfoarray [ 2 ] . PHP_EOL ;

    Please note that «Damien dot Garrido dot Work at gmail dot com» code is wrong, the third parameter of sprintf must be divided by 60.

    This is the corrected function:

    function timezone_offset_string ( $offset )
    <
    return sprintf ( «%s%02d:%02d» , ( $offset >= 0 ) ? ‘+’ : ‘-‘ , abs ( $offset / 3600 ), abs ( $offset % 3600 ) / 60 );
    >
    ?>

    You can use this function to convert given UTC datetime string to your application’s local datetime:

    function utc_to_local ( $utcDatetime , $format = ‘Y-m-d H:i:s’ )
    <
    $currentTimeZone = date_default_timezone_get ();

    $localDatetime = (new DateTime ( $utcDatetime ))
    -> setTimeZone (new DateTimeZone ( $currentTimeZone ));

    return $localDatetime -> format ( $format );
    >

    To get offset string from offset:

    function timezone_offset_string ( $offset )
    <
    return sprintf ( «%s%02d:%02d» , ( $offset >= 0 ) ? ‘+’ : ‘-‘ , abs ( $offset / 3600 ), abs ( $offset % 3600 ) );
    >

    $offset = timezone_offset_get ( new DateTimeZone ( ‘Pacific/Kiritimati’ ), new DateTime () );
    echo «offset: » . timezone_offset_string ( $offset ) . «\n» ;

    $offset = timezone_offset_get ( new DateTimeZone ( ‘Pacific/Tahiti’ ), new DateTime () );
    echo «offset: » . timezone_offset_string ( $offset ) . «\n» ;
    ?>

    Output:
    offset: +14:00
    offset: -10:00

    For the reason that date_default_timezone_get() throws an error when the timezone isn’t set in php.ini and then returns a default chosen by the system (rather than returning false to indicate to the script that a timezone hasn’t been set), I’ve found that the following works when you want a script to detect when the ini value has not been set and want the script itself to choose a default in that case, while still allowing bootstrap scripts to set their own default using date_default_timezone_set().

    (function ( $errno , $errstr ) <
    throw new Exception ( $errstr );
    return false ;
    >);
    try <
    date_default_timezone_get ();
    >
    catch( Exception $e ) <
    date_default_timezone_set ( ‘UTC’ ); // Sets to UTC if not specified anywhere in .ini
    >
    restore_error_handler ();

    If you want to get the abbrivation (3 or 4 letter), instead of the long timezone string you can use date(‘T’) function like this:

    Input:
    date_default_timezone_set(‘America/Los_Angeles’);
    echo date_default_timezone_get();
    echo ‘ => ‘.date(‘e’);
    echo ‘ => ‘.date(‘T’);

    Output:
    America/Los_Angeles => America/Los_Angeles => PST

    date_default_timezone_get() will still emit a warning in E_STRICT if the timezone is not set; either by date_default_timezone_set() or the ini option of date.timezone.

    This is probably not a big deal, but I thought I would contribute what I found.

    Источник

    Php вывести часовой пояс

    (PHP 4, PHP 5, PHP 7, PHP 8)

    date — Форматирует вывод системной даты/времени

    Описание

    Возвращает строку, отформатированную в соответствии с указанным шаблоном format . Используется метка времени, заданная аргументом timestamp , или текущее системное время, если timestamp не задан. Таким образом, timestamp является необязательным и по умолчанию равен значению, возвращаемому функцией time() .

    Список параметров

    Необязательный параметр timestamp представляет собой метку времени типа int , по умолчанию равную текущему локальному времени, если timestamp не указан или null . Другими словами, значение по умолчанию равно результату функции time() .

    Возвращаемые значения

    Возвращает отформатированную строку с датой. При передаче нечислового значения в качестве параметра timestamp будет возвращено false и вызвана ошибка уровня E_WARNING .

    Ошибки

    Каждый вызов к функциям даты/времени при неправильных настройках часового пояса сгенерирует ошибку уровня E_WARNING , если часовой пояс некорректный. Смотрите также date_default_timezone_set()

    Список изменений

    Версия Описание
    8.0.0 timestamp теперь допускает значение null.

    Примеры

    Пример #1 Примеры использования функции date()

    // установка часового пояса по умолчанию.
    date_default_timezone_set ( ‘UTC’ );

    // выведет примерно следующее: Monday
    echo date ( «l» );

    // выведет примерно следующее: Monday 8th of August 2005 03:12:46 PM
    echo date ( ‘l jS \of F Y h:i:s A’ );

    // выведет: July 1, 2000 is on a Saturday
    echo «July 1, 2000 is on a » . date ( «l» , mktime ( 0 , 0 , 0 , 7 , 1 , 2000 ));

    /* пример использования константы в качестве форматирующего параметра */
    // выведет примерно следующее: Mon, 15 Aug 2005 15:12:46 UTC
    echo date ( DATE_RFC822 );

    // выведет примерно следующее: 2000-07-01T00:00:00+00:00
    echo date ( DATE_ATOM , mktime ( 0 , 0 , 0 , 7 , 1 , 2000 ));
    ?>

    Чтобы запретить распознавание символа как форматирующего, следует экранировать его с помощью обратного слеша. Если экранированный символ также является форматирующей последовательностью, то следует экранировать его повторно.

    Пример #2 Экранирование символов в функции date()

    Для вывода прошедших и будущих дат удобно использовать функции date() и mktime() .

    Пример #3 Пример совместного использования функций date() и mktime()

    Данный способ более надёжен, чем простое вычитание и прибавление секунд к метке времени, поскольку позволяет при необходимости гибко осуществить переход на летнее/зимнее время.

    Ещё несколько примеров использования функции date() . Важно отметить, что следует экранировать все символы, которые необходимо оставить без изменений. Это справедливо и для тех символов, которые в текущей версии PHP не распознаются как форматирующие, поскольку это может быть введено в следующих версиях. Для экранировании управляющих последовательностей (например, \n) следует использовать одинарные кавычки.

    Пример #4 Форматирование с использованием date()

    // Предположим, что текущей датой является 10 марта 2001, 5:16:18 вечера,
    // и мы находимся в часовом поясе Mountain Standard Time (MST)

    $today = date ( «F j, Y, g:i a» ); // March 10, 2001, 5:16 pm
    $today = date ( «m.d.y» ); // 03.10.01
    $today = date ( «j, n, Y» ); // 10, 3, 2001
    $today = date ( «Ymd» ); // 20010310
    $today = date ( ‘h-i-s, j-m-y, it is w Day’ ); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
    $today = date ( ‘\i\t \i\s \t\h\e jS \d\a\y.’ ); // it is the 10th day.
    $today = date ( «D M j G:i:s T Y» ); // Sat Mar 10 17:16:18 MST 2001
    $today = date ( ‘H:m:s \m \i\s\ \m\o\n\t\h’ ); // 17:03:18 m is month
    $today = date ( «H:i:s» ); // 17:16:18
    $today = date ( «Y-m-d H:i:s» ); // 2001-03-10 17:16:18 (формат MySQL DATETIME)
    ?>

    Для форматирования дат на других языках используйте вместо date() функции setlocale() и strftime() .

    Примечания

    Для получения метки времени из строкового представления даты можно воспользоваться функцией strtotime() . Кроме того, некоторые базы данных имеют собственные функции для преобразования внутреннего представления даты в метку времени (например, функция MySQL » UNIX_TIMESTAMP).

    Временную метку начала запроса можно получить из поля $_SERVER[‘REQUEST_TIME’] .

    Смотрите также

    • gmdate() — Форматирует дату/время по Гринвичу
    • idate() — Преобразует локальное время/дату в целое число
    • getdate() — Возвращает информацию о дате/времени
    • getlastmod() — Получает время последней модификации страницы
    • mktime() — Возвращает метку времени Unix для заданной даты
    • strftime() — Форматирует текущую дату/время с учётом текущих настроек локали
    • time() — Возвращает текущую метку системного времени Unix
    • DateTimeImmutable::__construct() — Возвращает новый объект DateTimeImmutable
    • Предопределённые константы даты и времени

    User Contributed Notes 20 notes

    Things to be aware of when using week numbers with years.

    echo date ( «YW» , strtotime ( «2011-01-07» )); // gives 201101
    echo date ( «YW» , strtotime ( «2011-12-31» )); // gives 201152
    echo date ( «YW» , strtotime ( «2011-01-01» )); // gives 201152 too
    ?>

    BUT

    echo date ( «oW» , strtotime ( «2011-01-07» )); // gives 201101
    echo date ( «oW» , strtotime ( «2011-12-31» )); // gives 201152
    echo date ( «oW» , strtotime ( «2011-01-01» )); // gives 201052 (Year is different than previous example)
    ?>

    Reason:
    Y is year from the date
    o is ISO-8601 year number
    W is ISO-8601 week number of year

    Conclusion:
    if using ‘W’ for the week number use ‘o’ for the year.

    If you have a problem with the different time zone, this is the solution for that.
    // first line of PHP
    $defaultTimeZone = ‘UTC’ ;
    if( date_default_timezone_get ()!= $defaultTimeZone )) date_default_timezone_set ( $defaultTimeZone );

    // somewhere in the code
    function _date ( $format = «r» , $timestamp = false , $timezone = false )
    <
    $userTimezone = new DateTimeZone (!empty( $timezone ) ? $timezone : ‘GMT’ );
    $gmtTimezone = new DateTimeZone ( ‘GMT’ );
    $myDateTime = new DateTime (( $timestamp != false ? date ( «r» ,(int) $timestamp ): date ( «r» )), $gmtTimezone );
    $offset = $userTimezone -> getOffset ( $myDateTime );
    return date ( $format , ( $timestamp != false ?(int) $timestamp : $myDateTime -> format ( ‘U’ )) + $offset );
    >

    /* Example */
    echo ‘System Date/Time: ‘ . date ( «Y-m-d | h:i:sa» ). ‘
    ‘ ;
    echo ‘New York Date/Time: ‘ . _date ( «Y-m-d | h:i:sa» , false , ‘America/New_York’ ). ‘
    ‘ ;
    echo ‘Belgrade Date/Time: ‘ . _date ( «Y-m-d | h:i:sa» , false , ‘Europe/Belgrade’ ). ‘
    ‘ ;
    echo ‘Belgrade Date/Time: ‘ . _date ( «Y-m-d | h:i:sa» , 514640700 , ‘Europe/Belgrade’ ). ‘
    ‘ ;
    ?>
    This is the best and fastest solution for this problem. Working almost identical to date() function only as a supplement has the time zone option.

    In order to define leap year you must considre not only that year can be divide by 4!

    The correct alghoritm is:

    if (year is not divisible by 4) then (it is a common year)
    else if (year is not divisible by 100) then (it is a leap year)
    else if (year is not divisible by 400) then (it is a common year)
    else (it is a leap year)

    So the code should look like this:

    FYI: there’s a list of constants with predefined formats on the DateTime object, for example instead of outputting ISO 8601 dates with:

    echo date ( ‘Y-m-d\TH:i:sO’ );
    ?>

    You can use

    echo date ( DateTime :: ISO8601 );
    ?>

    instead, which is much easier to read.

    For Microseconds, we can get by following:

    echo date(‘Ymd His’.substr((string)microtime(), 1, 8).’ e’);

    Thought, it might be useful to someone !

    this how you make an HTML5 tag correctly

    echo ‘ . date ( ‘c’ ). ‘»>’ . date ( ‘Y — m — d’ ). ‘ ‘ ;

    ?>

    in the «datetime» attribute you should put a machine-readable value which represent time , the best value is a full time/date with ISO 8601 ( date(‘c’) ) . the attr will be hidden from users

    and it doesn’t really matter what you put as a shown value to the user,, any date/time format is okay !

    This is very good for SEO especially search engines like Google .

    It’s common for us to overthink the complexity of date/time calculations and underthink the power and flexibility of PHP’s built-in functions. Consider http://php.net/manual/en/function.date.php#108613

    function get_time_string ( $seconds )
    <
    return date ( ‘H:i:s’ , strtotime ( «2000-01-01 + $seconds SECONDS» ));
    >

    The following function will return the date (on the Gregorian calendar) for Orthodox Easter (Pascha). Note that incorrect results will be returned for years less than 1601 or greater than 2399. This is because the Julian calendar (from which the Easter date is calculated) deviates from the Gregorian by one day for each century-year that is NOT a leap-year, i.e. the century is divisible by 4 but not by 10. (In the old Julian reckoning, EVERY 4th year was a leap-year.)

    This algorithm was first proposed by the mathematician/physicist Gauss. Its complexity derives from the fact that the calculation is based on a combination of solar and lunar calendars.

    function getOrthodoxEaster ( $date ) <
    /*
    Takes any Gregorian date and returns the Gregorian
    date of Orthodox Easter for that year.
    */
    $year = date ( «Y» , $date );
    $r1 = $year % 19 ;
    $r2 = $year % 4 ;
    $r3 = $year % 7 ;
    $ra = 19 * $r1 + 16 ;
    $r4 = $ra % 30 ;
    $rb = 2 * $r2 + 4 * $r3 + 6 * $r4 ;
    $r5 = $rb % 7 ;
    $rc = $r4 + $r5 ;
    //Orthodox Easter for this year will fall $rc days after April 3
    return strtotime ( «3 April $year + $rc days» );
    >
    ?>

    At least in PHP 5.5.38 date(‘j.n.Y’, 2222222222) gives a result of 2.6.2040.

    So date is not longer limited to the minimum and maximum values for a 32-bit signed integer as timestamp.

    For HTML5 datetime-local HTML input controls (http://www.w3.org/TR/html-markup/input.datetime-local.html) use format example: 1996-12-19T16:39:57

    To generate this, escape the ‘T’, as shown below:

    If timestamp is a string, date converts it to an integer in a possibly unexpected way:

    echo (int) ‘0x10’ ; //0
    echo intval ( ‘0x10’ ); //0
    echo date ( ‘s’ , ‘0x10’ ); //gives 16
    //however, no octal conversion:
    echo date ( ‘s’ , ‘010’ ); //gives 10
    ?>

    (PHP 5.6.16)

    One important thing you should remember is that the timestamp value returned by time() is time-zone agnostic and gets the number of seconds since 1 January 1970 at 00:00:00 UTC. This means that at a particular point in time, this function will return the same value in the US, Europe, India, Japan, .

    date() will format a time-zone agnostic timestamp according to the default timezone set with date_default_timezone_set(. ). Local time. If you want to output as UTC time use:

    function dateUTC ( $format , $timestamp = null )
    <
    if ( $timestamp === null ) $timestamp = time ();

    $tz = date_default_timezone_get ();
    date_default_timezone_set ( ‘UTC’ );

    $result = date ( $format , $timestamp );

    date_default_timezone_set ( $tz );
    return $result ;
    >
    />

    Prior to PHP 5.6.23, Relative Formats for the start of the week aligned with PHP’s (0=Sunday,6=Saturday). Since 5.6.23, Relative Formats for the start of the week align with ISO-8601 (1=Monday,7=Sunday). (http://php.net/manual/en/datetime.formats.relative.php)

    This can produce different, and seemingly incorrect, results depending on your PHP version and your choice of ‘w’ or ‘N’ for the Numeric representation of the day of the week:

    echo «Today is Sun 2 Oct 2016, day » , date ( ‘w’ , strtotime ( ‘2016-10-02’ )), » of this week. » ;
    echo «Day » , date ( ‘w’ , strtotime ( ‘2016-10-02 Monday next week’ )), » of next week is » , date ( ‘d M Y’ , strtotime ( ‘2016-10-02 Monday next week’ )), «
    » ;

    echo «Today is Sun 2 Oct 2016, day » , date ( ‘N’ , strtotime ( ‘2016-10-02’ )), » of this week. » ;
    echo «Day » , date ( ‘w’ , strtotime ( ‘2016-10-02 Monday next week’ )), » of next week is » , date ( ‘d M Y’ , strtotime ( ‘2016-10-02 Monday next week’ ));
    ?>

    Prior to PHP 5.6.23, this results in:

    Today is Sun 2 Oct 2016, day 0 of this week. Day 1 of next week is 10 Oct 2016
    Today is Sun 2 Oct 2016, day 7 of this week. Day 1 of next week is 10 Oct 2016

    Since PHP 5.6.23, this results in:

    Today is Sun 2 Oct 2016, day 0 of this week. Day 1 of next week is 03 Oct 2016
    Today is Sun 2 Oct 2016, day 7 of this week. Day 1 of next week is 03 Oct 2016

    Most spreadsheet programs have a rather nice little built-in function called NETWORKDAYS to calculate the number of business days (i.e. Monday-Friday, excluding holidays) between any two given dates. I couldn’t find a simple way to do that in PHP, so I threw this together. It replicates the functionality of OpenOffice’s NETWORKDAYS function — you give it a start date, an end date, and an array of any holidays you want skipped, and it’ll tell you the number of business days (inclusive of the start and end days!) between them.

    I’ve tested it pretty strenuously but date arithmetic is complicated and there’s always the possibility I missed something, so please feel free to check my math.

    The function could certainly be made much more powerful, to allow you to set different days to be ignored (e.g. «skip all Fridays and Saturdays but include Sundays») or to set up dates that should always be skipped (e.g. «skip July 4th in any year, skip the first Monday in September in any year»). But that’s a project for another time.

    function networkdays ( $s , $e , $holidays = array()) <
    // If the start and end dates are given in the wrong order, flip them.
    if ( $s > $e )
    return networkdays ( $e , $s , $holidays );

    // Find the ISO-8601 day of the week for the two dates.
    $sd = date ( «N» , $s );
    $ed = date ( «N» , $e );

    // Find the number of weeks between the dates.
    $w = floor (( $e — $s )/( 86400 * 7 )); # Divide the difference in the two times by seven days to get the number of weeks.
    if ( $ed >= $sd ) < $w --; ># If the end date falls on the same day of the week or a later day of the week than the start date, subtract a week.

    // Calculate net working days.
    $nwd = max ( 6 — $sd , 0 ); # If the start day is Saturday or Sunday, add zero, otherewise add six minus the weekday number.
    $nwd += min ( $ed , 5 ); # If the end day is Saturday or Sunday, add five, otherwise add the weekday number.
    $nwd += $w * 5 ; # Add five days for each week in between.

    // Iterate through the array of holidays. For each holiday between the start and end dates that isn’t a Saturday or a Sunday, remove one day.
    foreach ( $holidays as $h ) <
    $h = strtotime ( $h );
    if ( $h > $s && $h $e && date ( «N» , $h ) 6 )
    $nwd —;
    >

    $start = strtotime ( «1 January 2010» );
    $end = strtotime ( «13 December 2010» );

    // Add as many holidays as desired.
    $holidays = array();
    $holidays [] = «4 July 2010» ; // Falls on a Sunday; doesn’t affect count
    $holidays [] = «6 September 2010» ; // Falls on a Monday; reduces count by one

    echo networkdays ( $start , $end , $holidays ); // Returns 246

    ?>

    Or, if you just want to know how many work days there are in any given year, here’s a quick function for that one:

    function workdaysinyear ( $y ) <
    $j1 = mktime ( 0 , 0 , 0 , 1 , 1 , $y );
    if ( date ( «L» , $j1 )) <
    if ( date ( «N» , $j1 ) == 6 )
    return 260 ;
    elseif ( date ( «N» , $j1 ) == 5 or date ( «N» , $j1 ) == 7 )
    return 261 ;
    else
    return 262 ;
    >
    else <
    if ( date ( «N» , $j1 ) == 6 or date ( «N» , $j1 ) == 7 )
    return 260 ;
    else
    return 261 ;
    >
    >

    Источник

    Читайте также:  Чем чистить доску магнитную маркерную доску
    Оцените статью