• 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

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

Wordpress wpdb->delete issue

How to find the date a user created their Google account

Laravel Passport - Not able to get token string in response?

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

PHP: Insert marker every 3 iterations

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Alert message after submitting form in PHP

WAMP Virtual Host not working

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

Group rows by column and sum another column within groups [duplicate]

Multiple order by in WooCommerce

PHP only Hit Counter?

Store multiple fields in JSON column (Nova CMS)

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

About Contact Privacy policy Terms and conditions