Students will be able to set the display format of date and time data in relational database management systems (RDBMS) and understand how this skill fits into the complete database development cycle required by the IGCSE ICT syllabus.
The IGCSE ICT syllabus (Section 18) expects candidates to demonstrate knowledge and practical skills across seven sub‑topics. The table below shows each sub‑topic, the key skills involved, and the specific relevance of date‑/time formatting.
| Sub‑topic (Syllabus) | Key Skills Required | Relevance of Date/Time Formatting |
|---|---|---|
| 18.1 Create a database structure |
|
Choosing the correct data type (DATE, TIME, DATETIME, TIMESTAMP) is the first step before any formatting can be applied. |
| 18.2 Design data‑entry forms |
|
Form controls display dates using a default format; you may need to override it so that users see the format required by the organisation or exam. |
| 18.3 Populate a database |
|
When importing, you must tell the RDBMS the source date format (e.g., DD/MM/YYYY) so that values are stored correctly. |
| 18.4 Retrieve data with queries |
|
Formatting functions (DATE_FORMAT, TO_CHAR, FORMAT) are used inside queries to control how dates appear in the result set, reports or exported files. |
| 18.5 Produce reports |
|
Report fields that show dates/times should use a consistent, readable format (e.g., dd/mm/yyyy) to avoid misinterpretation. |
| 18.6 Use data validation & error handling |
|
Validation often checks that a date is within a specific range (e.g., “≤ Today”). The format shown to the user must match the rule so the check works correctly. |
| 18.7 Consider localisation (locale & time‑zone) |
|
Convert UTC timestamps to the local time‑zone **before** applying a display format; otherwise the shown time may be wrong. |
DATE Stores a calendar date (year‑month‑day).TIME Stores a time of day (hour‑minute‑second).DATETIME Stores both date and time together (no automatic time‑zone handling).TIMESTAMP Stores a point in time, usually in UTC; many systems can auto‑convert to the session’s time‑zone.Choosing the correct type matters because it determines the range of values, the functions you can use, and how the system deals with time‑zones.
| Database | Function | Typical Syntax | Example (format = DD/MM/YYYY) | Result |
|---|---|---|---|---|
| MySQL | DATE_FORMAT(date, format) |
DATE_FORMAT(order_date, '%d/%m/%Y') |
DATE_FORMAT('2024-04-23', '%d/%m/%Y') |
23/04/2024 |
| PostgreSQL | TO_CHAR(date, format) |
TO_CHAR(order_date, 'DD/MM/YYYY') |
TO_CHAR('2024-04-23'::date, 'DD/MM/YYYY') |
23/04/2024 |
| Oracle | TO_CHAR(date, format) |
TO_CHAR(order_date, 'DD/MM/YYYY') |
TO_CHAR(DATE '2024-04-23', 'DD/MM/YYYY') |
23/04/2024 |
| SQL Server | FORMAT(date, format [, culture]) |
FORMAT(order_date, 'dd/MM/yyyy') |
FORMAT('2024-04-23', 'dd/MM/yyyy') |
23/04/2024 |
| Specifier | Meaning | MySQL | PostgreSQL / Oracle | SQL Server |
|---|---|---|---|---|
%d / DD | Day of month (01‑31) | Yes | Yes | Yes (dd) |
%m / MM | Month (01‑12) | Yes | Yes | Yes (MM) |
%Y / YYYY | Four‑digit year | Yes | Yes | Yes (yyyy) |
%H / HH24 | Hour 00‑23 (24‑hour clock) | Yes | Yes | Yes (HH) |
%h / HH12 | Hour 01‑12 (12‑hour clock) | Yes | Yes | Yes (hh) |
%i / MI | Minutes (00‑59) | Yes | Yes | Yes (mm) |
%s / SS | Seconds (00‑59) | Yes | Yes | Yes (ss) |
%b / MON | Abbreviated month name (Jan, Feb…) | Yes | Yes | Yes (MMM) |
%M / Month | Full month name | Yes | Yes | Yes (MMMM) |
Note: MySQL uses the percent sign (%) for all specifiers, whereas PostgreSQL/Oracle use plain letters, and SQL Server follows .NET date‑format patterns.
SELECT statement whenever you need a formatted value for a query, report or export.SET DATEFORMAT dmy; (affects only date literals, not the output of FORMAT).SET lc_time_names = 'en_GB'; changes month name language but not numeric format.SET datestyle = 'ISO, DMY'; changes how DATE literals are interpreted.ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY';.SELECT
order_id,
DATE_FORMAT(order_date, '%d/%m/%Y') AS order_date_formatted,
DATE_FORMAT(delivery_time, '%H:%i') AS delivery_time_formatted
FROM orders
WHERE order_date >= '2024-01-01'
ORDER BY order_date DESC;
dd/mm/yyyy.TIMESTAMP)Most RDBMS store timestamps in UTC. Convert to the required local zone **before** applying the formatting function.
| Database | Conversion Syntax (UTC → Local) |
|---|---|
| MySQL | CONVERT_TZ(ts_column, 'UTC', 'Europe/London') |
| PostgreSQL | ts_column AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/London' |
| Oracle | FROM_TZ(CAST(ts_column AS TIMESTAMP), 'UTC') AT TIME ZONE 'Europe/London' |
| SQL Server | ts_column AT TIME ZONE 'UTC' AT TIME ZONE 'GMT Standard Time' |
After conversion, wrap the result in the appropriate formatting function, e.g.:
-- PostgreSQL example
SELECT TO_CHAR(
ts_column AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/London',
'DD-Mon-YYYY HH24:MI'
) AS local_ts
FROM events;
SELECT query that uses a formatting function to display dates as required.YYYY‑MM‑DD.
SELECT DATE_FORMAT(CURDATE(), '%Y-%m-%d') AS today;
events has column event_ts of type TIMESTAMP. Show how to display it as Month DD, YYYY HH24:MI (e.g., “April 23, 2024 14:30”).SELECT TO_CHAR(event_ts, 'Month DD, YYYY HH24:MI') AS formatted_ts
FROM events;
DATE_FORMAT (MySQL) and TO_CHAR (PostgreSQL/Oracle) in terms of syntax, supported specifiers and typical use‑cases.
DATE_FORMAT(date, '%d/%m/%Y') – MySQL uses a leading % for every specifier; format string is a single quoted literal.TO_CHAR(date, 'DD/MM/YYYY') – PostgreSQL/Oracle use plain letters; no %. They also support additional date‑time elements (e.g., DY, FM for fill‑mode).DATE_FORMAT only in MySQL; use TO_CHAR in PostgreSQL and Oracle. Both return a VARCHAR value that can be displayed or exported.TIMESTAMP column called log_time to British Summer Time and format it as DD‑MMM‑YYYY HH24:MI.SELECT TO_CHAR(
FROM_TZ(CAST(log_time AS TIMESTAMP), 'UTC')
AT TIME ZONE 'Europe/London',
'DD-MON-YYYY HH24:MI'
) AS bst_log
FROM audit_log;
Books, Members, Loans). Indicate the data type you would use for the loan_date field and state the display format you would apply in the loan‑record form.loan_date – data type DATE.dd/mm/yyyy (British style) in the form’s property sheet.date_of_birth. Describe how you would set this validation rule and how the date would be shown to the user.Is Null Or [date_of_birth] <= Date().dd/mm/yyyy so the user sees the same layout as the validation message.DATE_FORMAT, TO_CHAR, FORMAT) to control the appearance of dates and times in queries, forms and reports.Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.