• 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

Yii Ajax Submit button

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

Handling expired token in Laravel

PHP how to detect if running on arm64 cpu?

Xdebug 3 not showing in phpinfo on m1 Monterey

how to hide previous markers when new markers added in google map javascript api

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

how to loop through json response data using ajax jquery?

How to use PHPCBF to fix one issue at a time?

could not find driver Debian SQL Server PHP

Using spatie/media-library, how to rename a collection of uploaded files?

image source not readable

Laravel: Why is my variable not being set while it's in the construct function of the controller?

Return new collection without modifying original collection

About Contact Privacy policy Terms and conditions