• 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

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Can't exclude directories from .htaccess mobile redirect?

Doctrine 2 mapping referencing unique key

How avoid Moved Permanently The document has moved here

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

advanced custom fields wordpress custom class

zsh: command not found: php

Edit product hook WooCommerce

Message: Set sys_temp_dir in your php.ini after installed composer

Problems getting instance of UploadedFile in Yii2

PHP, how to convert Int value to Week days

How can i hide dt if dd got empty value

java URL working on browser but not in client program

How to get values inside <![CDATA[values]] > using php DOM?

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

About Contact Privacy policy Terms and conditions