You are here

public static function DateTimeHelper::getFirstDayOfMonth in Content Planner 8

Get the first day of a given month and year.

Parameters

int $month:

int $year:

Return value

\DateTime

2 calls to DateTimeHelper::getFirstDayOfMonth()
Calendar::buildCalendarDataStructure in modules/content_calendar/src/Component/Calendar.php
Build data structure for Calendar.
ContentCalendarService::getNodesByType in modules/content_calendar/src/ContentCalendarService.php
Get Nodes by Type.

File

modules/content_calendar/src/DateTimeHelper.php, line 71

Class

DateTimeHelper

Namespace

Drupal\content_calendar

Code

public static function getFirstDayOfMonth($month, $year) {
  $datetime = new \DateTime();
  $datetime
    ->setDate($year, $month, 1);
  $datetime
    ->setTime(0, 0, 0);
  return $datetime;
}