DekGenius.com
Previous Section  < Day Day Up >  Next Section

9.6 Exercises

  1. Use strftime( ) to print a formatted time and date string that looks like this:

    Today is day 20 of October and day 294 of the year 2004. The time is 07:45 PM 
    (also known as 19:45).

    To make your output exactly match the example, use mktime( ) to get the epoch timestamp for 7:45 p.m. on October 20, 2004.

  2. Use date( ) to print the same formatted time and date string.

  3. The U.S. holiday Labor Day is the first Monday in September. Print out a table of the dates that Labor Day falls from 2004 to 2020.

  4. Write a PHP program that displays a form in which users select a day, month, and year in the future. Print out a list of all the Tuesdays between the current date and the date the user submits in the form.

    Previous Section  < Day Day Up >  Next Section