• 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

json_encode turns array into an object

Yii2 redirecting to previous page after login

Adding the custom page with add_menu_page function on Wordpress

sort() not affecting original array while inside foreach loop

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Extract house numbers from address string

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Why i get wrong output for html markdown?

Laravel post contact form giving me error 419

VB.NET WebRequest with PHP POST

Smarty if isset

Mysqli multi query error

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

LARAVEL: How to fetch id dynamically in a query builder?

dockerizing Laravel + vue

About Contact Privacy policy Terms and conditions