• 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 5 issue with wherePivot

Custom add to cart button URL for specific product in WooCommerce?

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Add a custom text for a particular product on specific email notification in Woocommerce

How to add a heading in between checkout fields of WooCommerce

Alert message after submitting form in PHP

PHP, how to convert Int value to Week days

PHP Array split string and Integers

PHP file_get_contents function

Parsing JSON File to array in PHP

Combine multiple columns into an array as one of the key in a results set

Navigation idle on content download

MySQL default time format UTC or GMT?

Querying only one row from a one to many relationship laravel

Laravel 5 controller sending JSON integer as string

About Contact Privacy policy Terms and conditions