• 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

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

Laravel Carbon throws error The format separator does not match

PHPExcel export HTML table to xlsx

LARAVEL: How to fetch id dynamically in a query builder?

Call to undefined function openssl_decrypt

PHP Warning: Module already loaded in Unknown on line 0

How to create tests w/Doctrine entities without persisting them (how to set id)

How to get unique slug to same post-title for other time too?

oauth-private.key does not exist or is not readable

PHP, how to convert Int value to Week days

Where do I need to place a hook for phpunit?

How to get variable from JavaScript to PHP [duplicate]

Laravel Collections. Is there some kind of assertStructure method?

PHP: PDO + CSV export not downloading (headers issue?)

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

About Contact Privacy policy Terms and conditions