• 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

PHP Include for HTML?

Laravel - Implicit route model binding with soft deleted data

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Laravel insert dynamic input values with radio button

Log file is not being written in Laravel 5.5

PHP my timezone is no setting up in PHP.ini File in xampp

getting error while enter Command => php artisan route:list

How to create a video stream from a single dynamic image in PHP

PHP Form Not Inserting

How to override header set in Apache config with more specific header in a virtual host

Form Validation and Submission to database

Symfony run hint kernel.secret parameter not found

Problems getting instance of UploadedFile in Yii2

PHP Array split string and Integers

Handle error for duplicate entries - PHP/MySQL

About Contact Privacy policy Terms and conditions