• 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

Dropzone: Submit both form data and dropzone at once

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

php echo remove slashes from url [duplicate]

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

How to create custom authentication in laravel 8?

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

PHP's array_map including keys

Laravel whole batch is cancelled if one Job fails

Phalcon: setStatusCode returns empty response

Laravel display validation error

Parameter is not sent to Laravel route in Ajax

Facebook PHP SDK - will not logout properly

Log a user out of a website when they put their computer to sleep

About Contact Privacy policy Terms and conditions