PHP code example of ildarik081 / time-helper

1. Go to this page and download the library: Download ildarik081/time-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ildarik081 / time-helper example snippets


use Ildarik081\TimeHelper;

// Получить дату в строковом формате: Сегодня, Завтра, Вчера, 27 Января 2023
TimeHelper::getInstance('2023-01-27 20:31:00')->today();

// Модифицировать дату и получить в строковом формате: Завтра
TimeHelper::getInstance('2023-01-27 20:31:00')->modify(1)->today();

// Модифицировать дату и получить в строковом формате: 27 Января 2023
TimeHelper::getInstance('2023-01-27 20:31:00')->longDate();

// Модифицировать дату и получить в строковом формате: ПТ 20:31
TimeHelper::getInstance('2023-01-27 20:31:00')->shortTime();

// Модифицировать дату и получить в строковом формате: Пятница
TimeHelper::getInstance('2023-01-27 20:31:00')->dayWeek();

// Модифицировать дату и получить в строковом формате: Январь
TimeHelper::getInstance('2023-01-27 20:31:00')->month(false);