• 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

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

Laravel no logout option from menu after successfull login

Upgrade PHP on AWS Linux

Populate Dynamic Dropdowns List in Codeigniter

How to execute sql code based on fetch array

Attempt to read property "view" on null when sending password reset email

using random function but it's displaying duplicates

Laravel 8 factory state afterCreating

Convert PHP array into HTML tag attributes separated by spaces

If action is on a different page do I use fwrite function

Yii2: How to download backup files using spanjeta/yii2-backup?

how to remove %20 in the url in php

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

PHP random string generator

How to use React Router with Laravel?

About Contact Privacy policy Terms and conditions