• 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

How to send image,audio or video through the WhatsApp API - PHP

could not find driver Debian SQL Server PHP

PHP Deprecated issue when running artisan command

Composer fails with kylekatarnls/update-helper on new homestead

laravel 5.6 bulk inserting json data

Laravel update hasMany relationship using saveMany

Image upload not working through ajax Laravel

How do I pass the dynamic output of a php variable or php function to a CSS variable?

MySQL order by field in Eloquent

Google API Heatmap Layer exception, why?

stay with the last 15 elements of an array [duplicate]

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

Return new collection without modifying original collection

The "client_reference_id" argument is not passed

Currently Using CodeIgniter Framework i have an Error

About Contact Privacy policy Terms and conditions