• 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

Detect if PHP session exists

Dynamic table in HTML using MySQL and php

Insert multidimensional array to codeigniter cart

Magento 2 - How to add new block to admin panel in product page?

IlluminateDatabaseQueryException could not find driver [duplicate]

php code to send checkbox form results to email

Attempted to call an undefined method named "get" of class "MailController"

Laravel after login Two factor not working

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Get data from accuweather api url

Convert every two values of an associative array into key-value pairs

Reload parent page after submit in iframe

phpunit - mockbuilder - set mock object internal property

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

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

About Contact Privacy policy Terms and conditions