SEC S20W6 || Date & Time Types And String Predefined Methods in PHP

in dynamicdevs-s20w6 •  last month  (edited)

steemit-engagement-challenge-cover.jpeg

Greetings Steemit friends

Task 1: (1 point)

Here’s a multiple-choice quiz (QCM) focused on PHP date and time functions, indicate the correct answer, and explain your choice.

  1. What does the checkdate function do in PHP?

    A. It formats a date into a specific string.
    B. It checks if a date is valid based on the day, month, and year.
    C. It returns the current timestamp.
    D. It adds a period to a date field.

B: This php function checks if the day, month, and year are validated making use of the day, month, and year parameters. These parameters are integers and not strings. This function does not return the timestamp, as it strictly works on the parameters I mentioned.

  1. What does the date function return if no timestamp is provided?

    A. The system's current date and time as a formatted string.
    B. The time elapsed since 1970 in seconds.
    C. The timestamp for midnight of the current day.
    D. A boolean value indicating whether the current date is valid.

A: The date function returns the current time based on the server's default timezone in the format 'Y-m-d'. You can only get any other formatted data if some specifications changes are done.

  1. Which of the following is true about the mktime function in PHP?

    A. It returns the current system timestamp.
    B. It generates a timestamp based on provided hour, minute, second, day, month, and year values.
    C. It checks the validity of a date.
    D. It converts a timestamp into a human-readable string.

B: mktime makes use of the parameters hour, minute, second, day, month, and year. mktime is used to return the Unix timestamp based on the server's default timezone for both date and time.

  1. What is the purpose of the strtotime function in PHP?

    A. It formats a date according to a specific format.
    B. It converts an English date string into a Unix timestamp.
    C. It compares two date strings.
    D. It checks if a date is in the future.

B: strtotime functions are used to convert date and time to Unix timestamps. strtotime function accepts different date formats, which are in string format, and converts for easy data input.

Task2: (3points)

Project: (6 points)

Ncin (ID number): CLT255, CLT256, CLT257, CLT258, CLT259, CLT260, CLT261
Give it a try

Week 6: Leisure equipment rental service

Part 1

Part 2

Part 2

Github link



Cheers
Thanks for dropping by
@fombae

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...

Upvoted! Thank you for supporting witness @jswit.

IMG_20240930_084439.png

Congratulations!!🎉🎉 Your post has been upvoted by TEAM 03 (content seekers) using steemcurator05. Continue making creative and quality content on the blog. By @damithudaya