• 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

IlluminateDatabaseQueryException could not find driver [duplicate]

Google API Heatmap Layer exception, why?

php code to send checkbox form results to email

Laravel phpunit test failing authorization

Woocommerce Checkout - Add conditional field required if one field is filled

Magento 2 - Controller returning blank page

How can I stop a symfony process which is listening on http://127.0.0.1:8000

how to pass row id in href of a tag in codeigniter controller?

Sort a multidimensional array by integer inside of a string value which is two levels down

Create tags in laravel post publishing

What is PHP's equivalent of JavaScript's "array.every()"?

How can I access an array/object?

Star rating with half star support

Pass an image through AJAX [duplicate]

laravel 5.6 bulk inserting json data

About Contact Privacy policy Terms and conditions