• 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

Getting values for an enum?

Laravel - Implicit route model binding with soft deleted data

Failing validation doesn't stop code execution in livewire component

php curl requesting twice

Convert regular text to array using notepad++

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

How to change the app environment at run time?

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

Error Class "LaravelFortifyFeatures" not found

PHP: convert all UTF-8 characters to HTML entities

How to Install Composer Require doctrine/dbal

Image upload not working through ajax Laravel

How to test a php login connected to a mysql db through xampp?

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

About Contact Privacy policy Terms and conditions