• 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

Store / Website Column in Magento 2 Admin Grid - Custom Module

How can I get user id from session in javascript?

Get orders by date and status woocommerce

php file upload scanning using clamav, permissions on /tmp/

How to access a var with "-" in PHP [duplicate]

PHP random string generator

Laravel multi auth - Authentication user provider [] is not defined

Laravel Get Days In Month From Month Number?

Querying only one row from a one to many relationship laravel

Remove categories with all childs derived from parent category

Using array_intersect on a multi-dimensional array

Adding Multiple Custom Post Types in Wordpress

array_key_exists(): The first argument should be either a string or an integer

PHP function Not Working As Expected From functions.php Include File

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

About Contact Privacy policy Terms and conditions