SQL 51 🛢️ Date and Time Arithmetic Functions
Dates and times are not numbers, but they behave like them in some ways and unlike them in others. Adding a day to a date is not the same as adding 1 to an integer, because months have different lengths and leap years exist. Subtracting two dates produces an interval, not a number. Extracting the month from a date produces an integer, but the function to do it depends on the database. SQL has a set of date and time functions for these operations, and the standard defines some while the databases implement their own variations of others.
This chapter covers date and time arithmetic: getting the current date and time, adding and subtracting intervals, calculating differences, extracting components, and formatting. The functions differ between PostgreSQL, MySQL, SQL Server, and Oracle, so the chapter notes the variations and focuses on the concepts that transfer.
Key point: Date arithmetic is not integer arithmetic. Adding one month to January 31 does not produce February 31; the database clamps the result to the last valid day of the month. Subtracting two dates produces an interval, not a number, in databases that distinguish the two. The functions for the current date (CURRENT_DATE, NOW()), the functions for intervals (INTERVAL '1 day'), and the functions for extraction (EXTRACT(MONTH FROM date)) are the core.
Why date arithmetic matters
The reporting problem. Reports are almost always time-based. “Sales for the last 30 days.” “Users who registered in the current month.” “Orders that shipped before the due date.” Each of these requires arithmetic on dates: adding an interval, subtracting an interval, or comparing dates.
The boundary problem. The boundaries of periods—the start of the month, the end of the quarter, the beginning of the week—are not stored; they are computed. The date_trunc or DATE_FORMAT function computes them. Getting the boundaries right is getting the report right.
The timezone problem. A timestamp is an instant, but “today” depends on the timezone. A server in UTC and a user in New York disagree about when the day started. The AT TIME ZONE clause converts between zones. Ignoring the timezone produces reports that are off by a day at the boundaries.
The portability problem. Date functions are among the least portable in SQL. PostgreSQL uses NOW(), CURRENT_DATE, and INTERVAL. MySQL uses NOW(), CURDATE(), and DATE_ADD. SQL Server uses GETDATE() and DATEADD. Oracle uses SYSDATE and ADD_MONTHS. The concepts are the same; the syntax is not.
The precision problem. A DATE has day precision. A TIMESTAMP has sub-second precision. A TIME has time-of-day precision. The type determines what arithmetic is possible and what is lost in the conversion. Adding a day to a DATE produces a DATE; adding a day to a TIMESTAMP produces a TIMESTAMP.
a. Current date and time
Every database has functions for the current date and time. The names differ.
| Database | Current date | Current time | Current timestamp |
|---|---|---|---|
| Standard | CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP |
| PostgreSQL | CURRENT_DATE | CURRENT_TIME | NOW(), CURRENT_TIMESTAMP |
| MySQL | CURDATE(), CURRENT_DATE | CURTIME() | NOW(), CURRENT_TIMESTAMP |
| SQL Server | CAST(GETDATE() AS DATE) | CAST(GETDATE() AS TIME) | GETDATE(), SYSDATETIME() |
| Oracle | TRUNC(SYSDATE) | — | SYSTIMESTAMP |
The standard functions are supported by PostgreSQL, MySQL, and Oracle. SQL Server uses GETDATE().
SELECT CURRENT_DATE;
-- 2026-01-08
SELECT CURRENT_TIMESTAMP;
-- 2026-01-08 10:30:00.123456+00
The NOW() function in PostgreSQL is equivalent to CURRENT_TIMESTAMP and returns the transaction start time. The CURRENT_TIMESTAMP in the standard is also the transaction start time in most databases. The clock_timestamp() in PostgreSQL returns the actual current time, which advances during a transaction.
SELECT NOW();
-- 2026-01-08 10:30:00.123456+00
SELECT clock_timestamp();
-- 2026-01-08 10:30:01.456789+00
The difference matters in a long transaction: NOW() returns the same value for every call, and clock_timestamp() returns a different value each time.
The CURRENT_DATE is the date in the session’s timezone. If the session’s timezone is not UTC, the date may differ from the UTC date.
SET TIME ZONE 'America/New_York';
SELECT CURRENT_DATE;
-- 2026-01-08 (in New York)
The AT TIME ZONE clause converts a timestamp to a different zone.
SELECT NOW() AT TIME ZONE 'America/New_York';
-- 2026-01-08 05:30:00.123456
The result is a timestamp without a timezone, representing the wall clock in the specified zone.
b. Adding and subtracting intervals
An interval is a duration. In PostgreSQL, the INTERVAL type represents it.
SELECT INTERVAL '1 day';
SELECT INTERVAL '1 month';
SELECT INTERVAL '1 year';
SELECT INTERVAL '2 hours 30 minutes';
SELECT INTERVAL '1 year 2 months 3 days';
An interval can be added to a date or timestamp.
SELECT CURRENT_DATE + INTERVAL '1 day';
-- 2026-01-09
SELECT CURRENT_DATE - INTERVAL '1 day';
-- 2026-01-07
SELECT NOW() + INTERVAL '2 hours';
-- 2026-01-08 12:30:00.123456+00
The addition is not simple integer addition. Adding one month to January 31 produces February 28 (or 29 in a leap year), because February does not have 31 days. The database clamps the result to the last valid day.
SELECT DATE '2026-01-31' + INTERVAL '1 month';
-- 2026-02-28
Adding one year to February 29 produces February 28, because the next year is not a leap year.
SELECT DATE '2024-02-29' + INTERVAL '1 year';
-- 2025-02-28
The clamping is the correct behavior for most reporting. It is not the same as adding 30 days.
SELECT DATE '2026-01-31' + INTERVAL '30 days';
-- 2026-03-02
The INTERVAL '1 month' and INTERVAL '30 days' are not the same. The month interval respects the calendar; the day interval does not.
MySQL uses DATE_ADD and DATE_SUB with a unit.
SELECT DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY);
SELECT DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH);
SELECT DATE_ADD(NOW(), INTERVAL 2 HOUR);
The unit is one of MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, and their plural forms.
SQL Server uses DATEADD with a datepart and a number.
SELECT DATEADD(day, 1, GETDATE());
SELECT DATEADD(month, -1, GETDATE());
SELECT DATEADD(hour, 2, GETDATE());
The datepart is one of year, quarter, month, dayofyear, day, week, weekday, hour, minute, second, millisecond, microsecond, nanosecond.
Oracle uses ADD_MONTHS for months and arithmetic for days.
SELECT SYSDATE + 1 FROM dual; -- tomorrow
SELECT SYSDATE - 7 FROM dual; -- a week ago
SELECT ADD_MONTHS(SYSDATE, 1) FROM dual; -- next month
The + 1 on an Oracle date adds one day. The unit is always days for the arithmetic operators.
c. Differences, extraction, and truncation
Subtracting two dates produces an interval in PostgreSQL.
SELECT DATE '2026-01-08' - DATE '2026-01-01';
-- 7
SELECT TIMESTAMP '2026-01-08 10:00:00' - TIMESTAMP '2026-01-08 08:00:00';
-- 02:00:00
The result of subtracting two dates is an integer (the number of days) in PostgreSQL. The result of subtracting two timestamps is an interval.
MySQL uses DATEDIFF for days and TIMEDIFF for time.
SELECT DATEDIFF('2026-01-08', '2026-01-01');
-- 7
SELECT TIMEDIFF('2026-01-08 10:00:00', '2026-01-08 08:00:00');
-- 02:00:00
SQL Server uses DATEDIFF with a datepart.
SELECT DATEDIFF(day, '2026-01-01', '2026-01-08');
-- 7
SELECT DATEDIFF(hour, '2026-01-08 08:00', '2026-01-08 10:00');
-- 2
The DATEDIFF function counts the boundaries crossed, not the full units. DATEDIFF(year, '2025-12-31', '2026-01-01') returns 1, even though less than a day has passed.
Extracting a component from a date uses EXTRACT in the standard and PostgreSQL.
SELECT EXTRACT(YEAR FROM CURRENT_DATE);
-- 2026
SELECT EXTRACT(MONTH FROM CURRENT_DATE);
-- 1
SELECT EXTRACT(DAY FROM CURRENT_DATE);
-- 8
SELECT EXTRACT(DOW FROM CURRENT_DATE);
-- 4 (0 = Sunday)
SELECT EXTRACT(DOY FROM CURRENT_DATE);
-- 8 (day of year)
SELECT EXTRACT(WEEK FROM CURRENT_DATE);
-- 2 (ISO week)
SELECT EXTRACT(QUARTER FROM CURRENT_DATE);
-- 1
MySQL uses EXTRACT with the same units, and also YEAR(), MONTH(), DAY(), HOUR(), and similar functions.
SELECT EXTRACT(YEAR FROM CURRENT_DATE);
SELECT YEAR(CURRENT_DATE);
SELECT MONTH(CURRENT_DATE);
SQL Server uses DATEPART and YEAR(), MONTH(), DAY().
SELECT DATEPART(year, GETDATE());
SELECT YEAR(GETDATE());
SELECT MONTH(GETDATE());
Truncating a date to a period uses date_trunc in PostgreSQL.
SELECT date_trunc('month', CURRENT_DATE);
-- 2026-01-01 00:00:00
SELECT date_trunc('year', CURRENT_DATE);
-- 2026-01-01 00:00:00
SELECT date_trunc('week', CURRENT_DATE);
-- 2026-01-05 00:00:00 (Monday)
SELECT date_trunc('day', NOW());
-- 2026-01-08 00:00:00
The truncation is the way to compute period boundaries. The first day of the month, the first day of the year, the start of the week.
MySQL uses DATE_FORMAT with a format string to truncate.
SELECT DATE_FORMAT(CURRENT_DATE, '%Y-%m-01');
-- 2026-01-01
SELECT DATE_FORMAT(CURRENT_DATE, '%Y-01-01');
-- 2026-01-01
SQL Server uses DATETRUNC (SQL Server 2022+) or DATEADD with DATEDIFF.
SELECT DATETRUNC(month, GETDATE());
-- 2026-01-01
SELECT DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0);
-- 2026-01-01
The DATETRUNC function is the modern form. The DATEADD/DATEDIFF combination is the classic form and works on older versions.
Formatting a date as a string uses to_char in PostgreSQL.
SELECT to_char(CURRENT_DATE, 'YYYY-MM-DD');
-- 2026-01-08
SELECT to_char(NOW(), 'YYYY-MM-DD HH24:MI:SS');
-- 2026-01-08 10:30:00
MySQL uses DATE_FORMAT.
SELECT DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d');
-- 2026-01-08
SQL Server uses FORMAT or CONVERT.
SELECT FORMAT(GETDATE(), 'yyyy-MM-dd');
SELECT CONVERT(varchar, GETDATE(), 23);
The FORMAT function is the modern form. The CONVERT style code 23 is the classic ISO format.
Complete Example Session
-- ============================================
-- PART 1: CURRENT DATE AND TIME
-- ============================================
SELECT CURRENT_DATE;
SELECT CURRENT_TIMESTAMP;
SELECT NOW();
-- ============================================
-- PART 2: ADD INTERVAL
-- ============================================
SELECT CURRENT_DATE + INTERVAL '1 day';
SELECT CURRENT_DATE + INTERVAL '1 month';
SELECT NOW() + INTERVAL '2 hours 30 minutes';
-- ============================================
-- PART 3: SUBTRACT INTERVAL
-- ============================================
SELECT CURRENT_DATE - INTERVAL '7 days';
SELECT CURRENT_DATE - INTERVAL '1 year';
-- ============================================
-- PART 4: MONTH CLAMPING
-- ============================================
SELECT DATE '2026-01-31' + INTERVAL '1 month';
-- 2026-02-28
SELECT DATE '2024-02-29' + INTERVAL '1 year';
-- 2025-02-28
-- ============================================
-- PART 5: DATE DIFFERENCE
-- ============================================
SELECT DATE '2026-01-08' - DATE '2026-01-01';
-- 7
SELECT TIMESTAMP '2026-01-08 10:00:00' - TIMESTAMP '2026-01-08 08:00:00';
-- 02:00:00
-- ============================================
-- PART 6: EXTRACT COMPONENTS
-- ============================================
SELECT EXTRACT(YEAR FROM CURRENT_DATE);
SELECT EXTRACT(MONTH FROM CURRENT_DATE);
SELECT EXTRACT(DAY FROM CURRENT_DATE);
SELECT EXTRACT(DOW FROM CURRENT_DATE);
SELECT EXTRACT(QUARTER FROM CURRENT_DATE);
-- ============================================
-- PART 7: TRUNCATE TO PERIOD
-- ============================================
SELECT date_trunc('month', CURRENT_DATE);
SELECT date_trunc('year', CURRENT_DATE);
SELECT date_trunc('week', CURRENT_DATE);
-- ============================================
-- PART 8: FORMAT
-- ============================================
SELECT to_char(CURRENT_DATE, 'YYYY-MM-DD');
SELECT to_char(NOW(), 'YYYY-MM-DD HH24:MI:SS');
-- ============================================
-- PART 9: TIME ZONE
-- ============================================
SELECT NOW() AT TIME ZONE 'America/New_York';
SELECT NOW() AT TIME ZONE 'UTC';
-- ============================================
-- PART 10: AGE AND INTERVAL
-- ============================================
SELECT AGE(TIMESTAMP '2026-01-08', TIMESTAMP '2020-05-15');
-- 5 years 7 mons 24 days
SELECT EXTRACT(YEAR FROM AGE(TIMESTAMP '2026-01-08', TIMESTAMP '2020-05-15'));
-- 5
The ten parts covered current date and time, adding an interval, subtracting an interval, month clamping, date differences, extraction, truncation, formatting, time zone conversion, and AGE.
Quick Reference
Current Date and Time
| Database | Date | Timestamp |
|---|---|---|
| Standard | CURRENT_DATE | CURRENT_TIMESTAMP |
| PostgreSQL | CURRENT_DATE | NOW(), clock_timestamp() |
| MySQL | CURDATE() | NOW() |
| SQL Server | CAST(GETDATE() AS DATE) | GETDATE() |
| Oracle | TRUNC(SYSDATE) | SYSTIMESTAMP |
Interval Arithmetic
| Database | Add | Subtract |
|---|---|---|
| PostgreSQL | date + INTERVAL '1 day' | date - INTERVAL '1 day' |
| MySQL | DATE_ADD(date, INTERVAL 1 DAY) | DATE_SUB(date, INTERVAL 1 DAY) |
| SQL Server | DATEADD(day, 1, date) | DATEADD(day, -1, date) |
| Oracle | date + 1 | date - 1 |
Difference
| Database | Days | Time |
|---|---|---|
| PostgreSQL | d1 - d2 | t1 - t2 |
| MySQL | DATEDIFF(d1, d2) | TIMEDIFF(t1, t2) |
| SQL Server | DATEDIFF(day, d1, d2) | DATEDIFF(hour, t1, t2) |
| Oracle | d1 - d2 | — |
Extraction
| Database | Extract |
|---|---|
| Standard | EXTRACT(YEAR FROM date) |
| MySQL | EXTRACT(YEAR FROM date), YEAR(date) |
| SQL Server | DATEPART(year, date), YEAR(date) |
Truncation
| Database | Truncate |
|---|---|
| PostgreSQL | date_trunc('month', date) |
| MySQL | DATE_FORMAT(date, '%Y-%m-01') |
| SQL Server | DATETRUNC(month, date) |
| Oracle | TRUNC(date, 'MM') |
Formatting
| Database | Format |
|---|---|
| PostgreSQL | to_char(date, 'YYYY-MM-DD') |
| MySQL | DATE_FORMAT(date, '%Y-%m-%d') |
| SQL Server | FORMAT(date, 'yyyy-MM-dd') |
| Oracle | TO_CHAR(date, 'YYYY-MM-DD') |
Best Practices
✅ Do This:
-- Use INTERVAL for date arithmetic
SELECT CURRENT_DATE + INTERVAL '1 month'; -- ✅
-- Use date_trunc for period boundaries
SELECT date_trunc('month', CURRENT_DATE); -- ✅
-- Use EXTRACT for components
SELECT EXTRACT(MONTH FROM order_date) FROM orders; -- ✅
-- Use AT TIME ZONE for timezone conversion
SELECT NOW() AT TIME ZONE 'America/New_York'; -- ✅
-- Use AGE for human-readable differences
SELECT AGE(NOW(), created_at) FROM users; -- ✅
-- Use date_trunc to group by month
SELECT date_trunc('month', order_date) AS month, SUM(amount)
FROM orders GROUP BY 1; -- ✅
❌ Don’t Do This:
-- Don't add days as an integer and expect month behavior
SELECT DATE '2026-01-31' + 30; -- not a month -- ⚠️
-- Don't assume DATEDIFF returns full units
DATEDIFF(year, '2025-12-31', '2026-01-01'); -- returns 1 -- ⚠️
-- Don't ignore the timezone
SELECT CURRENT_DATE; -- depends on session zone -- ⚠️
-- Don't use string concatenation for date arithmetic
WHERE date > '2026-01' || '-01'; -- fragile -- ❌
-- Don't compare dates as strings
WHERE date_string > '2026-01-08'; -- depends on format -- ⚠️
-- Don't use NOW() when clock_timestamp() is needed
SELECT NOW(); -- transaction start time -- ⚠️
-- Don't forget that adding a month clamps the day
SELECT DATE '2026-01-31' + INTERVAL '1 month'; -- Feb 28 -- ✅
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Month clamping surprises | January 31 + 1 month | Expected behavior |
DATEDIFF returns boundaries | Counts crossings | Use full-unit logic |
| Timezone mismatch | Session zone differs | Use AT TIME ZONE |
NOW() same in transaction | Transaction start | Use clock_timestamp() |
| String comparison of dates | Lexical vs chronological | Use date types |
EXTRACT returns numeric | Type is numeric | Cast if needed |
| Format string differences | Database-specific | Check the docs |
Real-World Examples
1. Last 30 Days
SELECT * FROM orders
WHERE order_date >= CURRENT_DATE - INTERVAL '30 days';
2. Start of Month
SELECT date_trunc('month', CURRENT_DATE);
3. End of Month
SELECT date_trunc('month', CURRENT_DATE) + INTERVAL '1 month' - INTERVAL '1 day';
4. Age in Years
SELECT EXTRACT(YEAR FROM AGE(NOW(), birth_date)) AS age
FROM users;
5. Group by Month
SELECT date_trunc('month', order_date) AS month, SUM(amount)
FROM orders
GROUP BY 1
ORDER BY 1;
6. Days Between
SELECT DATE '2026-01-08' - DATE '2026-01-01' AS days;
7. Add Business Days
SELECT order_date + INTERVAL '3 days' AS ship_date
FROM orders;
8. Filter by Year
SELECT * FROM orders
WHERE EXTRACT(YEAR FROM order_date) = 2026;
9. Timezone Conversion
SELECT created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York'
FROM users;
10. Quarter Boundary
SELECT date_trunc('quarter', CURRENT_DATE);
Visual
Interval Arithmetic
┌─────────────────────────────────────────────────────────────┐
│ DATE '2026-01-31' + INTERVAL '1 month' │
│ │
│ January 2026 has 31 days. │
│ February 2026 has 28 days. │
│ │
│ Adding one month would produce February 31. │
│ The database clamps to February 28. │
│ │
│ Result: 2026-02-28 │
│ │
├─────────────────────────────────────────────────────────────┤
│ │
│ DATE '2026-01-31' + INTERVAL '30 days' │
│ │
│ Adding 30 days is simple day arithmetic. │
│ │
│ January 31 + 30 days = March 2. │
│ │
│ Result: 2026-03-02 │
│ │
│ The two are not the same. │
│ │
└─────────────────────────────────────────────────────────────┘
Date Truncation
┌─────────────────────────────────────────────────────────────┐
│ NOW() = 2026-01-08 10:30:00 │
│ │
│ date_trunc('year', NOW()) → 2026-01-01 00:00:00 │
│ date_trunc('quarter', NOW())→ 2026-01-01 00:00:00 │
│ date_trunc('month', NOW()) → 2026-01-01 00:00:00 │
│ date_trunc('week', NOW()) → 2026-01-05 00:00:00 │
│ date_trunc('day', NOW()) → 2026-01-08 00:00:00 │
│ date_trunc('hour', NOW()) → 2026-01-08 10:00:00 │
│ │
│ Truncation computes the start of the period. │
│ │
└─────────────────────────────────────────────────────────────┘
Difference Types
┌─────────────────────────────────────────────────────────────┐
│ SUBTRACTING DATES │
│ │
│ DATE '2026-01-08' - DATE '2026-01-01' = 7 │
│ Result: integer (days) │
│ │
├─────────────────────────────────────────────────────────────┤
│ │
│ SUBTRACTING TIMESTAMPS │
│ │
│ TIMESTAMP '2026-01-08 10:00' - TIMESTAMP '2026-01-08 08:00'│
│ Result: interval '02:00:00' │
│ │
├─────────────────────────────────────────────────────────────┤
│ │
│ AGE() │
│ │
│ AGE(TIMESTAMP '2026-01-08', TIMESTAMP '2020-05-15') │
│ Result: interval '5 years 7 mons 24 days' │
│ │
│ Human-readable difference between two timestamps. │
│ │
└─────────────────────────────────────────────────────────────┘
Timezone Conversion
┌─────────────────────────────────────────────────────────────┐
│ NOW() = 2026-01-08 15:30:00+00 (UTC) │
│ │
│ AT TIME ZONE 'America/New_York' │
│ → 2026-01-08 10:30:00 (UTC-5) │
│ │
│ AT TIME ZONE 'Asia/Tokyo' │
│ → 2026-01-09 00:30:00 (UTC+9) │
│ │
│ The instant is the same. │
│ The wall clock differs. │
│ │
│ CURRENT_DATE in New York: 2026-01-08 │
│ CURRENT_DATE in Tokyo: 2026-01-09 │
│ │
└─────────────────────────────────────────────────────────────┘
Summary
| Operation | PostgreSQL | MySQL | SQL Server |
|---|---|---|---|
| Current date | CURRENT_DATE | CURDATE() | CAST(GETDATE() AS DATE) |
| Current timestamp | NOW() | NOW() | GETDATE() |
| Add interval | date + INTERVAL '1 day' | DATE_ADD(date, INTERVAL 1 DAY) | DATEADD(day, 1, date) |
| Subtract interval | date - INTERVAL '1 day' | DATE_SUB(date, INTERVAL 1 DAY) | DATEADD(day, -1, date) |
| Difference | d1 - d2 | DATEDIFF(d1, d2) | DATEDIFF(day, d1, d2) |
| Extract | EXTRACT(YEAR FROM d) | EXTRACT(YEAR FROM d) | DATEPART(year, d) |
| Truncate | date_trunc('month', d) | DATE_FORMAT(d, '%Y-%m-01') | DATETRUNC(month, d) |
| Format | to_char(d, 'YYYY-MM-DD') | DATE_FORMAT(d, '%Y-%m-%d') | FORMAT(d, 'yyyy-MM-dd') |
Key takeaways:
- Date arithmetic is not integer arithmetic. Adding one month to January 31 produces February 28, not February 31. The database clamps the result to the last valid day. The
INTERVAL '1 month'andINTERVAL '30 days'are not equivalent. CURRENT_DATEandNOW()are the current date and timestamp. TheNOW()returns the transaction start time in PostgreSQL. Theclock_timestamp()returns the actual current time.- Subtracting two dates produces an interval or an integer. In PostgreSQL,
DATE - DATEis an integer (days) andTIMESTAMP - TIMESTAMPis an interval. In MySQL, useDATEDIFFandTIMEDIFF. In SQL Server, useDATEDIFFwith a datepart. EXTRACTretrieves a component.EXTRACT(YEAR FROM date),EXTRACT(MONTH FROM date),EXTRACT(DAY FROM date), and the other units. The function name differs by database for some units.date_trunccomputes period boundaries. The start of the month, the start of the year, the start of the week. The function is the tool for grouping by month, quarter, or year.- Timezone matters.
CURRENT_DATEdepends on the session’s timezone. TheAT TIME ZONEclause converts between zones. The same instant has different dates in different zones. - Date functions are the least portable in SQL. The concepts are consistent, but the syntax differs. The
INTERVALtype is PostgreSQL and standard. MySQL usesDATE_ADDwith units. SQL Server usesDATEADD. Oracle uses arithmetic onSYSDATE.
Remember: Dates and times are not numbers. They have calendar rules, timezones, and precision. The functions for arithmetic, extraction, truncation, and formatting are the tools for working with them. Learn the PostgreSQL forms, because the exam and most examples use them, and know that MySQL, SQL Server, and Oracle have equivalents with different names. The concepts transfer; the syntax does not. Use INTERVAL for durations, date_trunc for period boundaries, EXTRACT for components, and AT TIME ZONE for timezone conversion. And remember the clamping behavior: adding a month is not adding 30 days.
Stop using slow, ad-bloated tool sites! 🤮
🔎 Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
✅ Finance (Mortgage, Interest, Inflation)
✅ Tech (Base64, JSON, Dev Suite, IP)
✅ Health (BMI, BMR, TDEE)
✅ Productivity (Timer, Workspace, QR)
⚡️ Fast & Private
🔒 No data leaves your device
💎 100% Free
🔗 Use it now: https://tools.kandz.me
🔖 Bookmark it—you’ll need it later!