PHP code example of owlcorp / doctrine-microseconds-datetime

1. Go to this page and download the library: Download owlcorp/doctrine-microseconds-datetime library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

owlcorp / doctrine-microseconds-datetime example snippets


     declare(strict_types=1);
    
    use Doctrine\ORM\Mapping as ORM;
    
    #[ORM\Entity]
    class MicroEntity
    {
        #[ORM\Column(type: 'time_micro')] //you can use text names
        public \DateTime $time;
    
        #[ORM\Column(type: TimeImmutableMicroType::NAME)] //or constants
        public \DateTimeImmutable $timeImmutable;
    
        /**
         * @ORM\Column(type="datetime_micro") Of course, it works with annotations too
         */
        public \DateTime $dateTime;
    }