Chapter 10-
Which of the following statements is NOT a valid way to create a timestamp named $birthdate that represents December 2, 1969?
$birthdate = mktime(12, 2, 1969);
To create a DateTime object that represents a due date that's 90 days after the current date, you use the following code:
$days = new DateInterval('P90D');$due_date = new DateTime();$due_date = $due_date->add($days);
$current_date = new DateTime();$due_days_diff = $current_date->diff($due_date);if ($current_date > $due_date) {$overdue_message = $due_days_diff->format('%y years, %m months, and %d days overdue.');} (Refer to code example 10-1) If $due_date contains a DateTime object for a date that comes 1 month and 7 days before the date stored in the $current_date variable, what will $overdue_message contain when this code finishes executing:
0 years, 1 months, and 7 days overdue.
The diff() method of a DateTime object requires another DateTime object as its argument and returns a/an ________________ object.
DateInterval
The use of ________________ objects resolves the Y2K38 problem because the upper limits of dates and times are essentially removed.
DateTime
If the date is December 25, 2017, what output would be produced by the code below? echo date('M. d, Y');
Dec. 25, 2017
If the date is December 25, 2017, what output would be produced by the code below? echo date('F d, Y');
December 25, 2017
To create a DateTime object for the current date, you use the ________________ keyword and pass no arguments to the constructor.
new
When you use the strtotime() function, you can use an absolute template to create a timestamp for the date that you specify, or you can use a ________________ template to create a timestamp for the current date and adjust it based on the offsets that you specify.
relative
A timestamp stores the number of ________________ since midnight on January 1, 1970 GMT.
seconds
After you create a DateTime object, you can use its setTime() method to change the time or its ________________ method to change the date.
setDate
A DateInterval object represents a/an ________________ of time rather than a point in time.
span
When you create a DateInterval object, you pass it one argument that specifies one or more of the following:
years, months, weeks, days, hours, minutes, seconds
Which method of a DateTime object can be used to determine an amount of time between two dates or times?
diff()
If the date is December 25, 2017, what output would be produced by the code below? echo date('n/j/y');
12/25/17
If the date is December 25, 2017, what output would be produced by the code below? echo date('n/j/Y');
12/25/2017
If the date is December 25, 2017, what output would be produced by the code below? echo date('n/d/Y h:i A');
12/25/2017 12:00 AM
The date() function makes it easy to create a timestamp for the current date and ________________ it before returning the value.
format
