• 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 properly set "0000-00-00 00:00:00" as a DateTime in PHP

phpsymfonydatetimedoctrine-orm


PHP Snippet 1:

$entEmail = new Email();
$entEmail->setViewedAt(null);

PHP Snippet 2:

$Date = date('Y-m-d H:i:s');

PHP Snippet 3:

date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s');

$entEmail = new Email();
$entEmail->setViewedAt( $date );

PHP Snippet 4:

date_default_timezone_set('America/New_York');

$entEmail = new Email();
$entEmail->setViewedAt( date('Y-m-d H:i:s') );

Related Snippets

Cache clear probem in Larave

How can I access an array/object?

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

CONCAT columns with Laravel 5 eloquent

xdebug 3 not working in ubuntu 20.04 with docker

Yii2 redirecting to previous page after login

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

PHP password_verify

Transpose and flatten multiple rows of array data [duplicate]

Laravel Multi-language routes without prefix

Why does array_map() with null as callback create an "array of arrays"?

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

Form repeater send wrong data with last element in Laravel

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

How in Laravel run JavaScript code stored in php variable?

About Contact Privacy policy Terms and conditions