public function getPeriodFirstDate($periodValue)
    {
        $result = $periodValue;
        if ($this->isPeriodYear($periodValue)) {
            $dt = date_create_from_format('Y', $periodValue);
            $ts = strtotime('first day of January', $dt->getTimestamp());
            $dt = $this->toDateTime($ts);
            $result = date_format($dt, 'Ymd');
        } else {
            if ($this->isPeriodMonth($periodValue)) {
                $dt = date_create_from_format('Ymd', $periodValue . '01');
                $ts = strtotime('first day of', $dt->getTimestamp());
                $dt = $this->toDateTime($ts);
                $result = date_format($dt, 'Ymd');
            }
        }
        return $result;
    }
public function getPeriodFirstDate($periodValue)
    {
        $result = $periodValue;
        if ($this->isPeriodYear($periodValue)) {
            $dt = date_create_from_format('Y', $periodValue);
            $ts = strtotime('first day of January', $dt->getTimestamp());
            $dt = $this->toDateTime($ts);
            $result = date_format($dt, 'Ymd');
        } else {
            if ($this->isPeriodMonth($periodValue)) {
                $dt = date_create_from_format('Ymd', $periodValue . '01');
                $ts = strtotime('first day of', $dt->getTimestamp());
                $dt = $this->toDateTime($ts);
                $result = date_format($dt, 'Ymd');
            }
        }
        return $result;
    }
public function getPeriodFirstDate ( $ periodValue ) { $ result = $ periodValue ; if ( $ this -> isPeriodYear ( $ periodValue ) ) { $ dt = date_create_from_format ( 'Y' , $ periodValue ) ; $ ts = strtotime ( 'first day of January' , $ dt -> getTimestamp ( ) ) ; $ dt = $ this -> toDateTime ( $ ts ) ; $ result = date_format ( $ dt , 'Ymd' ) ; } else { if ( $ this -> isPeriodMonth ( $ periodValue ) ) { $ dt = date_create_from_format ( 'Ymd' , $ periodValue . '01' ) ; $ ts = strtotime ( 'first day of' , $ dt -> getTimestamp ( ) ) ; $ dt = $ this -> toDateTime ( $ ts ) ; $ result = date_format ( $ dt , 'Ymd' ) ; } } return $ result ; }
Return the datestamp for the first date of the month or year period.

@param $periodValue 'YYYY' or 'YYYYMM'

@return string 'YYYYMMDD' - the first datestamp for the given period.
Return the datestamp for the first date of the month or year period .