• 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

Cut an arabic string

enable Apache http Authorization header

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Laravel websockets AWS EC2 - Connection failed

PHP: How to solve ob_start() in combination imagepng() issue?

PHP Imap , php 7.4.3 on mac osx catalina

How to create laravel storage symbolic link for production or sub domain system?

PHPUnit (Phar) Fatal Error Only When Test Fails

How can I get user id from session in javascript?

How to submit a form when page loads using JavaScript?

Valet, Xdebug after reboot Big Sur not working

Extract string between first whitespace and last whitespace in php

I cannot create a auto generated date time in mysql workbench

PHP array, move keys and values to new array, but mix it up

PHP 8.1: strftime() is deprecated

About Contact Privacy policy Terms and conditions