• 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

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Warning: A non-numeric value encountered

Laravel no logout option from menu after successfull login

Sum array values

PHP using str_starts_with for array to exclude same as with wildcard

PHP usort() order in case of equality

Shortcode or PHP inside a shortcode in Wordpress

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

nginx err_connection_refused, can anyone help me?

Why i get wrong output for html markdown?

How to downgrade or install a specific version of Composer?

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

PHP Download MP3 files from directory on server

merge all files in directory to one text file

How to validate Envato Purchase Code in PHP

About Contact Privacy policy Terms and conditions