• 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

HTML and PHP in one file

Laravel - Browser displays message again when I press back button

Convert regular text to array using notepad++

Xdebug 3 not showing in phpinfo on m1 Monterey

PHP returning an error message and false

Redirect to previous page with php

Having trouble with PDO queries (Notice: Undefined index)

Fatal error: Array callback has to contain indices 0 and 1

Custom add to cart button URL for specific product in WooCommerce?

Log file is not being written in Laravel 5.5

Issue with laravel eloquent model property

PHP Download MP3 files from directory on server

Component install error: JInstaller: :Install: File does not exist

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

I want to display default profile image if user do not have profile image

About Contact Privacy policy Terms and conditions