Site icon sharedsapience.info

PHP Quiz: All Calendar Functions

The first row of the PHP calendar function quiz, sized for desktop viewing.

An image of the first row of the PHP calendar function quiz, sized for desktop viewing.

HOW THE QUIZ WORKS:

Clicking the ‘randomize’ button situated above the reference table generates a new table whereby the function descriptions, function syntaxes, and function return values are randomized. The quiz involves matching the function descriptions, function syntaxes, and function return values to the correct function name. Information relating to the randomization of table cells will be displayed for three seconds, before disappearing.

On a desktop computer, table elements are selected by left-clicking the desired table cell and holding the left click in the mouse down position for one second before releasing the left click. The text inside the table cell will turn red to indicate that the one-second mouse left-click has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second left mouse-click process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second left mouse-click process on the original table cell.

To select a table element on a touchscreen device (mobile, tablet), simply touch the desired table cell and maintain the touch for one second before removing your finger from the screen. The text inside the table cell will turn red to indicate that the one-second touch has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second touch process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second touch process on the original table cell.

Normal touchscreen scrolling behaviour is exhibited by the cells with a light green background; cells without a light green background will not respond to normal touchscreen scrolling. The table is positioned in such a way that the user can also initiate touchscreen scrolling by swiping to the right or left of the table.

When a row consists of the correct function name, function description, function syntax, and function return value, the background colour of the row will change from ‘transparent’ to ‘khaki’; this provides visual feedback that the row is complete.

Once the entire table is complete, a paragraph of feedback will congratulate the user and provide the following information: date and time of quiz commencement; date and time of quiz completion; and the length of time it took the user to complete the quiz.

VIEWPORT OPTIONS:

An example of the layout designed for mobile phones
An example of the layout designed for tablets
An example of the layout designed for desktop computers

PURPOSE:

This webpage serves two purposes:

  1. It provides a reference table for the PHP calendar functions, with information extracted and condensed from w3schools.com and php.net.
  2. It enables users to complete a quiz related to the PHP calendar functions.

USAGE:

For each calendar function there are four table cells of information: the function name; the function description; the function syntax; and the function return value. There are three layouts available – ‘mobile‘, ‘tablet‘, and ‘desktop‘.

Click the relevant button below to display the PHP calendar functions reference table, sized appropriately for the desired viewport. A ‘RANDOMIZE‘ button appears above the reference table once the viewport is selected; clicking this button facilitates the commencement of a quiz.



Click the ‘RANDOMIZE‘ button to randomize the functional descriptions, the functional syntaxes, and the functional return information.



FUNCTION NAME FUNCTION DESCRIPTION FUNCTION SYNTAX FUNCTION RETURN VALUE
cal_days_in_month()

[Return the number of days in a month for a given year and calendar]

Returns the number of days in the month of year for the specified calendar. cal_days_in_month(calendar, month, year); Returns an integer representing the length in days of the selected month in the specified calendar.
cal_from_jd()

[Converts from Julian Day Count to a supported calendar]

Converts julian_day into a date of the specified calendar. Supported calendar types: CAL_GREGORIAN; CAL_JULIAN; CAL_JEWISH; and CAL_FRENCH. cal_from_jd(julian_day, calendar); Returns an array containing calendar information, including month, day, year, day of week (dow), abbreviated and full names of weekday and month, and the date in string form “month/day/year”. dow ranges from 0 (Sunday) to 6 (Saturday).
cal_info()

[Returns information about a particular calendar]

Returns information about the specified calendar. The following names can be used as the calendar parameter: 0 or CAL_GREGORIAN; 1 or CAL_JULIAN; 2 or CAL_JEWISH; and 3 or CAL_FRENCH. cal_info(calendar [optional parameter]);

[If no calendar is specified, information about all supported calendars is returned in an array.]

Returns an array containing information about the specified calendar or about all supported calendars if calendar is not specified. The following elements are included in the array: calname, calsymbol, month, abbrevmonth, and maxdaysinmonth.
cal_to_jd()

[Converts from a supported calendar to Julian Day Count]

Calculates the Julian Day Count for a date in calendar. Supported calendars are: CAL_GREGORIAN; CAL_JULIAN; CAL_JEWISH; and CAL_FRENCH. cal_to_jd(calendar, month, day, year); Returns a Julian Day number.
easter_date()

[Get Unix timestamp for midnight on Easter of a given year]

Returns the Unix timestamp corresponding to midnight on Easter of year. easter_date(year [optional parameter]);

[If supplied, year must be in the range 1970-2037; a WARNING is generated if year falls outside these Unix timestamp boundaries. If year is omitted, the current year according to the local time is used in the calculation.]

Returns the Easter date as a Unix timestamp.
easter_days()

[Get number of days after March 21 on which Easter falls for a given year]

Returns the number of days after March 21 on which Easter falls for year. Can be used instead of easter_date() to calculate Easter for years which fall outside of the Unix timestamp era [1970-2037]. easter_days(year, method);

[Both year and method are optional parameters. If year is omitted, the current year is assumed. Possible values for method: CAL_EASTER_DEFAULT; CAL_EASTER_ROMAN; CAL_EASTER_ALWAYS_GREGORIAN; and CAL_EASTER_ALWAYS_JULIAN.]

Returns the number of days after March 21 that Easter Sunday falls on in year.
frenchtojd()

[Converts a date from the French Republican calendar to a Julian Day Count]

Converts a date from the French Republican Calendar to a Julian Day Count. frenchtojd(month, day, year);

[month must be a number from 1 (for Vendémiaire) to 13 (for the period of 5-6 days at the end of the year). day must be a number from 1 to 30. year must be a number from 1 to 14, representing Gregorian dates 22 September 1792-22 September 1806.]

Returns the Julian Day for the given French Revolution date as an integer.
gregoriantojd()

[Converts a Gregorian date to Julian Day Count]

Converts a Gregorian date to Julian Day count. gregoriantojd(month, day, year);

[month is given as a number from 1 (January)-12 (December). day is given as a number from 1-31; if month has fewer days than day, overflow occurs. year is given as a number between -4714 and 9999.]

Returns the Julian Day number for the given Gregorian date, as an integer. Dates outside the valid range return 0.
jddayofweek()

[Returns the day of the week]

Returns the day of the week. jddayofweek(julianday, mode [optional parameter]);

[mode can have the following values: 0 (default) – returns the day number as an integer, Sunday as 0, Monday as 1, and so on; 1 – returns a string containing the day of the week (English-Gregorian); or 2 – returns a string containing the abbreviated day of the week (English-Gregorian).]

Returns the Gregorian weekday as either an integer or a string.
jdmonthname()

[Returns a month name]

Returns a string containing a month name. mode specifies which calendar to convert julian_day to, and what type of month names are to be returned. jdmonthname(julian_day, mode);

[Possible mode values: CAL_MONTH_GREGORIAN_SHORT (Gregorian – abbreviated); CAL_MONTH_GREGORIAN_LONG (Gregorian); CAL_MONTH_JULIAN_SHORT (Julian – abbreviated); CAL_MONTH_JULIAN_LONG (Julian); CAL_MONTH_JEWISH (Jewish); and CAL_MONTH_FRENCH (French Republican).]

Returns a string containing the month name for the given julian_day and mode.
jdtofrench()

[Converts a Julian Day Count to the French Republican Calendar]

Converts julian_day_count to the French Republican Calendar. jdtofrench(julian_day_count); Returns the French Revolution date as a string in the form “month/day/year”.
jdtogregorian()

[Converts Julian Day Count to Gregorian date]

Converts julian_day to a string representing the Gregorian date in the form “month/day/year”. jdtogregorian(julian_day); Returns the Gregorian date as a string in the form “month/day/year”.
jdtojewish()

[Converts a Julian Day Count to a Jewish calendar date]

Converts julian_day_count to the Jewish calendar. jdtojewish(julian_day_count, hebrew [optional parameter], fl [optional parameter]);

[if the hebrew parameter is set to TRUE, the fl parameter is used for Hebrew, ISO-8859-8 encoded string-based output. fl represents a bitmask which may consist of the following values: CAL_JEWISH_ADD_ALAFIM_GERESH; CAL_JEWISH_ADD_ALAFIM; or CAL_JEWISH_ADD_GERESHAYIM.]

Returns the Jewish date as a string in the form “month/day/year”, or an ISO-8859-8 encoded Hebrew date string, according to the hebrew parameter.
jdtojulian()

[converts a Julian Day Count to a Julian Calendar date]

Converts julian_day to a string containing the Julian Calendar Date in the format of “month/day/year”. jdtojulian(julian_day); Returns the Julian Date as a string in the form “month/day/year”.
jdtounix()

[Convert Julian Day to Unix timestamp]

Converts julian_day to a Unix timestamp. The time returned is UTC. jdtounix(julian_day);

[julian_day must be inside the Unix Epoch (between Gregorian years 1970 and 2037, i.e. a count in the range 2440588 – 2465342).]

Returns the Unix timestamp for the start (midnight, not noon) of julian_day on success; FALSE if julian_day is not within the Unix Epoch.
jewishtojd()

[Converts a date in the Jewish calendar to Julian Day Count]

Converts a Jewish Calendar date to Julian Day Count. In the early days of the Jewish Calendar there was no formula to determine the start of a month – a new month was started when the new moon was observed. Thus, although this function can handle dates all the way back to year 1 (3761 B.C.), using this function to calculate Jewish dates from millennia ago might not be meaningful. jewishtojd(month, day, year);

[month is represented by an integer ranging from 1-13, with 1 meaning Tishri, 13 meaning Elul, and 6 and 7 meaning Adar in regular years, but meaning Adar I and Adar II (respectively) in leap years; day is represented by an integer ranging from 1-30 – if the month only has 29 days then the first day of the following month is assumed; and year is represented by an integer ranging from 1-9999.]

Returns the Julian Day as an integer for the given Jewish date.
juliantojd()

[Converts a Julian Calendar date to Julian Day Count]

Converts a date from the Julian Calendar to Julian Day Count. The Julian Calendar’s permitted range is from 4713 B.C. to 9999 A.D. This calendar was created in 46 B.C. but did not stabilize until at least 8 A.D., and perhaps as late as the fourth century. Furthermore, not all cultures accepted January as the first month. As such, using this function to calculate dates from millennia ago might not be meaningful. juliantojd(month, day, year);

[month is represented by an integer in the range 1 (January)-12 (December); day is represented by an integer in the range 1-31; and year is represented by an integer in the range -4713 to 9999.]

Returns the Julian Day as an integer for the given Julian date.
unixtojd()

[Convert Unix timestamp to Julian Day]

Returns the Julian Day for a Unix timestamp [seconds since 1.1.1970], if supplied, or for the current day if timestamp is not supplied. The time is regarded as local time, not Universal Time Coordinated [UTC]. unixtojd(timestamp [optional parameter]); Returns a Julian Day number conversion of a Unix timestamp as integer.

Web design certified by:
Click images for proof of certification.

Exit mobile version