Int Web Prog Ch10
One of the methods of a/an ________________ object lets you add a DateInterval object to it.
DateTime
If the date is December 25, 2017, what output would be produced by the code below? echo date('F d, Y');
December 25, 2017
A timestamp stores the number of ________________ since midnight on January 1, 1970 GMT.
seconds
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);
If the date is December 25, 2017, what output would be produced by the code below? echo date('M. d, Y');
Dec. 25, 2017
To create a DateTime object for the current date, you use the ________________ keyword and pass no arguments to the constructor.
new
A DateInterval object represents a/an ________________ of time rather than a point in time.
span
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);
Code example 10-1 $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, $due_date_diff will contain
a DateInterval object
Which method of a DateTime object can be used to determine an amount of time between two dates or times?
diff()
The date() function makes it easy to create a timestamp for the current date and ________________ it before returning the value.
format
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
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 ______________ is an integer that represents a date and time as the number of seconds since midnight, January 1, 1970.
timestamp
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
Code example 10-1 $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.
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
Because most systems today store timestamps as 32-bit signed integers, the upper limit of a timestamp on these systems is January 19 in the year________________.
2038
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
Timestamps will encounter a(n) _______ problem if they are not converted to DateTime objects.
Y2K38
