CSCI 315 Exam Prep
If $today contains a DateTime object for December 25, 2021, what output would be produced by the code below? echo $today->format('n/j/y'); 12/25/2021 Dec. 25, 2021 December 25, 2021 12/25/21
12/25/21
If $today contains a DateTime object for December 25, 2021, what output would be produced by the code below?echo $today->format('M. d, Y'); 12/25/2021 Dec. 25, 2021 December 25, 2021 12/25/21
Dec. 25, 2021
A timestamp stores the number of ________________ since midnight on January 1, 1970 GMT. hours minutes seconds microseconds
seconds
When you create a DateInterval object, you pass it one argument that specifies one or more of the following: years, months, days hours, minutes, seconds years, months, days, hours, minutes, seconds years, months, weeks, days, hours, minutes, seconds
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, $due_date_diff will contain a TimeStamp object a DateTime object a DateInterval object a TimeInterval object
a DateInterval object
To create a DateTime object based on the date and time you specifiy, you use a/an ________________ template. absolute relative fixed adjustable
absolute
Which of the following is a method of a DateTime object that can be used to add a period of time to the date? addInterval() addspan() addDate() add()
add()
Which of the following functions can you use to modify a DateTime object? setDate() setTime() modify() all of these
all of these
Which of the following is a method of a DateTime object that can be used to determine an amount of time between two dates or times? diff() datediff() datebetween() add()
diff()
To create a DateTime object for the current date, you use the ________________ keyword and pass no arguments to the constructor. date now new create
new
To create a DateTime object based on an offset you specify to the current date and time, you use a/an ________________ template. absolute relative fixed adjustable
relative
A/An ______________ is an integer that represents a date and time as the number of seconds since midnight, January 1, 1970. timestamp intdate date_format checkdate
timestamp
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 = date();$due_date = $due_date->add($days); $days = new DateInterval('P90D');$due_date = new DateTime();$due_date = $due_date->add($days); $days = new DateInterval('P90D');$due_date = date();$due_date = $due_date + $days; $days = new DateInterval('P90D');$due_date = new DateTime();$due_date = $due_date + $days;
$days = new DateInterval('P90D');$due_date = new DateTime();$due_date = $due_date->add($days);
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. -0 years, -1 months, and -7 days overdue. 1 month and 7 days overdue. $overdue_message won't be set because the if clause won't be executed
0 years, 1 months, and 7 days overdue.
If $today contains a DateTime object for December 25, 2021, what output would be produced by the code below? echo $today->format('n/j/Y'); 12/25/2021 December 25, 2021 Dec. 25, 2021 12/25/21
12/25/2021
If $today contains a DateTime object for December 25, 2021, what output would be produced by the code below? echo $today->format('n/d/Y h:i A'); 12/25/2021 12/25/2021 12:00 AM December 25, 2021 12/25/21
12/25/2021 12:00 AM
The diff() method of a DateTime object requires another DateTime object as its argument and returns a/an ________________ object. DateTime DateInterval TimeSpan none of these
DateInterval
The use of ________________ objects resolves the Y2K38 problem because the upper limits of dates and times are essentially removed. Date DateTime Time DateInterval
DateTime
If $today contains a DateTime object for December 25, 2021, what output would be produced by the code below?echo $today->format('F d, Y'); 12/25/2021 Dec. 25, 2021 December 25, 2021 12/25/21
December 25, 2021
Timestamps will encounter a/an _______ problem if they are not converted to DateTime objects. Y2K Y2K38 Y10K Y69K
Y2K38
