• 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

Refresh specific HTML content that retrieves data from MySQL

Results page in other window

Laravel - Implicit route model binding with soft deleted data

Object of class stdClass could not be converted to string error

stay with the last 15 elements of an array [duplicate]

Backend cannot be reached after Typo3 login screen

Apply filter array/return terms

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

WordPress Security Standards want me to escape my html, but how to do it correctly?

PHP echo values of all sub keys [duplicate]

Minimum order amount except for specific shipping method in WooCommerce

Telegram bot doesn't answer

How to avoid terminal to catch error instead of Symfony profiler

Where do I need to place a hook for phpunit?

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

About Contact Privacy policy Terms and conditions