• 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

Call authenticate manually in router middleware

Artisan, creating tables in database

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

Edit XML in HTML form and submit to self

How to install php_imagick on wamp64

Display the WooCommerce product price inside a custom function

merging two arrays with specified index

how to check version of codeigniter framework?

Populate Dynamic Dropdowns List in Codeigniter

Handling expired token in Laravel

Group data in a multidimensional array based on two columns

No definition found for function in vendor vscode

Update Order custom Field value with WooCommerce REST API

How to get Laravel's CSRF Token from Another Website?

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

About Contact Privacy policy Terms and conditions