• 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: Is there a non-case sensitive way to sort a collection by an attribute?

VB.NET WebRequest with PHP POST

How to get the ID of the link in another page in php

str_replace or preg_replace random number from string

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

php echo xml documents with header

Is it possible to change the table name in the migration file-laravel

Laravel whole batch is cancelled if one Job fails

How do I call Validator from a namespace with an already existing Validator class

Custom API and cunsuming in php?

Transform array, set each array element with parent key php

How to install LDAP in Docker php-fpm alpine

zsh: command not found: php

How avoid Moved Permanently The document has moved here

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

About Contact Privacy policy Terms and conditions