• 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

PHP mail function is sending blank message body

How to get array values using foreach in laravel

Transpose and flatten multiple rows of array data [duplicate]

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

Put content of wordpress page inside div

Display the default discounted price and percentage on Woocommerce products

Detect emoticons in string

Show rotation of tweets using current day of month

Extract house numbers from address string

html-php form submission after validation through JavaScript [closed]

How do I upload a laravel project on cPanel shared hosting?

Create a new line whenever an array value reaches more than 10 characters

How to add class name to an existing tag in php

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

Dynamic table in HTML using MySQL and php

About Contact Privacy policy Terms and conditions