• 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

Laravel print last executed SQL query with Query log

Show date difference as "20" instead of "20 years ago"

Laravel Excel::store file empty after stored

Sort multidimensional array by column value within a column

Parameter is not sent to Laravel route in Ajax

CodeIgniter force_download is not working

Why does using salted hash on python and php give me different results?

Create tags in laravel post publishing

How to make a foreign key not using primary key

Laravel Jetsream Profile page not loading on fresh install

PHP: set a (deep) array key from an array [closed]

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

How to create a video stream from a single dynamic image in PHP

cakephp save drag and drop list order to database

Explode not working properly with dash

About Contact Privacy policy Terms and conditions