• 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

Inserting data into SQL Server Db An Invalid direction was specified

Getting public posts of a random user from Facebook API

How to skip cart page on woocomerce for certain products only?

Show Custom Data in Woocommerce Order Details Admin Area

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

How to add automatically collapse/expand in content wordpress (single.php)?

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

How to get Laravel's CSRF Token from Another Website?

How to break out of a foreach once a condition is met?

Laravel database insert with combining array and string

Laravel PHP: multiple project run at the same time [closed]

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Call to undefined function openssl_decrypt

How to keep value of selected value after form submission?

About Contact Privacy policy Terms and conditions