• 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

Extract house numbers from address string

User pool client {id}does not exist

Stop caching for PHP 5.5.3 in MAMP

get attribute from class not working php 7

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

PDOException SQLSTATE[HY000] [2002] No such file or directory

Insert database rows from columns of data from associative array of indexed arrays

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

Problem with fetching data from database in Laravel

SMTP "Error: DATA not accepted from server!" Opencart 2.3 on InMotionHosting

PHP: Telegram Bot: Insert line break to text message

Custom post type single page not working

How to KeyBy where multiple items have the same key

php file upload scanning using clamav, permissions on /tmp/

unable to load your default controller on Codeigniter

About Contact Privacy policy Terms and conditions