• 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

PHP Discord OAUTH2 code sample not working

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

Call to a member function fetch_field() on a non-object MySQLiDB

PHP sort array of objects by two properties

How to disable only_full_group_by option in Laravel

Inserting Country Selection into MySQL PHP [duplicate]

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Combine multiple columns into an array as one of the key in a results set

xdebug 3 not working in ubuntu 20.04 with docker

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Undefined variable in Laravel 8 project (php 7.4)

Phalcon: setStatusCode returns empty response

Laravel websockets AWS EC2 - Connection failed

how to check version of codeigniter framework?

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

About Contact Privacy policy Terms and conditions