• 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

Currently Using CodeIgniter Framework i have an Error

Custom post type single page not working

Sort a multidimensional array by integer inside of a string value which is two levels down

PHP using str_starts_with for array to exclude same as with wildcard

Composer Warning: openssl extension is missing. How to enable in WAMP

How can I get new CSRF token in LARAVEL by using ajax

How to create a scheduler application in php

Pages are working fine on localhost but not running on the hosting server

How to submit a form when page loads using JavaScript?

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

How to upload mpdf file after generating to s3 bucket in php

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Laravel get user data with profile

MySQL upgrade causing unexpected results on simple WHERE clauses

TesseractOCR not working for Laravel

About Contact Privacy policy Terms and conditions