src/Types/DateTime/Traits/Factory.php
public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null,
        $second = null, TimeZone $tz = null)
    {
        [$nowYear, $nowMonth, $nowDay, $nowHour, $nowMin, $nowSec] = explode('-', date('Y-n-j-G-i-s', time()));

        $year   = $year ?? $nowYear;
        $month  = $month ?? $nowMonth;
        $day    = $day ?? $nowDay;
        $hour   = $hour ?? $nowHour;
        $minute = $minute ?? $nowMin;
        $second = $second ?? $nowSec;
        $tz     = $tz ?? TimeZone::create();

        return static::createFromFormat(
            'Y-n-j G:i:s',
            sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second),
            $tz->toNative()
        );
    }
public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null,
        $second = null, TimeZone $tz = null)
    {
        [$nowYear, $nowMonth, $nowDay, $nowHour, $nowMin, $nowSec] = explode('-', date('Y-n-j-G-i-s', time()));

        $year   = $year ?? $nowYear;
        $month  = $month ?? $nowMonth;
        $day    = $day ?? $nowDay;
        $hour   = $hour ?? $nowHour;
        $minute = $minute ?? $nowMin;
        $second = $second ?? $nowSec;
        $tz     = $tz ?? TimeZone::create();

        return static::createFromFormat(
            'Y-n-j G:i:s',
            sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second),
            $tz->toNative()
        );
    }
public static function create ( $ year = null , $ month = null , $ day = null , $ hour = null , $ minute = null , $ second = null , TimeZone $ tz = null ) { [ $ nowYear , $ nowMonth , $ nowDay , $ nowHour , $ nowMin , $ nowSec ] = explode ( '-' , date ( 'Y-n-j-G-i-s' , time ( ) ) ) ; $ year = $ year ?? $ nowYear ; $ month = $ month ?? $ nowMonth ; $ day = $ day ?? $ nowDay ; $ hour = $ hour ?? $ nowHour ; $ minute = $ minute ?? $ nowMin ; $ second = $ second ?? $ nowSec ; $ tz = $ tz ?? TimeZone :: create ( ) ; return static :: createFromFormat ( 'Y-n-j G:i:s' , sprintf ( '%s-%s-%s %s:%02s:%02s' , $ year , $ month , $ day , $ hour , $ minute , $ second ) , $ tz -> toNative ( ) ) ; }
Create a DateTime instance

Based on Carbon::create with the following differences:
* if you require an hour, you must specify minutes and seconds as 0 (zero)
* TimeZone should be specified using the value object

@param null|int      $year
@param null|int      $month
@param null|int      $day
@param null|int      $hour
@param null|int      $minute
@param null|int      $second
@param null|TimeZone $tz

@return bool|DateTime
Create a DateTime instance