• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to set time with DateTime modify?

php


PHP Snippet 1:

$periodauction = '2018-04-09T10:00:00';
$date = DateTime::createFromFormat('Y-m-d\TH:i:s', $periodauction)->modify('-1 day');
$date->setTime(18,0);
echo $date->format('Y-m-d\TH:i:s');

PHP Snippet 2:

2018-04-08T18:00:00

Related Snippets

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

Inserting Country Selection into MySQL PHP [duplicate]

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

Connecting an HTML webpage to a SQL Server

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

PHPExcel How to set conditional formatting to change cell background color based on cells values

wordpress : How to specify the cause "This site can’t be reached"

PHP Fatal error: Class not found - PHPUnit

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

laravel controller function parameters

Laravel You requested 1 items, but there are only 0 items available

how to sort by a custom appended relation to model

Login if user is active using Laravel Breeze

PHP: Print caught exception like Xdebug

About Contact Privacy policy Terms and conditions