Add 2 hours to current time in MySQL?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
To add two hours to the current time in MySQL, use DATE_ADD or interval arithmetic. The most common query is DATE_ADD(NOW(), INTERVAL 2 HOUR), which returns the current date and time plus two hours.
This is straightforward, but it helps to be precise about whether you want the current time only, the full current datetime, or an updated column value in a table. MySQL can handle all three with the same interval syntax.
Add Two Hours to the Current Datetime
The clearest version is:
NOW() returns the current date and time according to the session time zone, and DATE_ADD shifts it forward by the requested interval.
A shorter equivalent is:
Both are valid. Many developers prefer DATE_ADD because it is explicit and easy to read.
Add Two Hours to the Current Time Only
If you only care about the time component, use CURTIME():
Or use interval syntax with a datetime function and then extract the time portion if needed. The best choice depends on whether the date component matters to the result.
For example, if the current time is 23:30:00, adding two hours crosses midnight. If you use only TIME values, think carefully about whether you want the date rollover to matter.
Update a Column by Two Hours
You can also use the same interval logic in an UPDATE statement:
That increments an existing datetime column by two hours. It is the same function, just applied to a column instead of NOW().
DATE_ADD Versus ADDTIME
These two functions are related but not identical.
Use DATE_ADD when you are adding a typed interval such as hours, days, or months:
Use ADDTIME when you already want to express the addition as a time literal:
For this particular question, DATE_ADD with INTERVAL 2 HOUR is the most idiomatic answer. It is also easier to extend later if the requirement becomes days, minutes, or mixed intervals.
Think About Time Zones
NOW() is evaluated in the current MySQL session time zone. If your application and database operate across multiple zones, the arithmetic itself is still correct, but the displayed result depends on session configuration.
That matters especially when:
- sessions use different time zones
- your app stores UTC but displays local time elsewhere
- daylight-saving transitions are relevant to the business rule
If you need consistency across systems, be explicit about time-zone policy rather than assuming the server default is always correct.
Common Pitfalls
- Using string concatenation or manual time math instead of MySQL interval functions.
- Forgetting that
NOW()returns a full datetime, not only the clock time. - Ignoring time-zone configuration when comparing application time and database time.
- Using a
TIMEcolumn when the business rule actually depends on date rollover too.
Summary
- The standard answer is
SELECT DATE_ADD(NOW(), INTERVAL 2 HOUR);. - '
NOW() + INTERVAL 2 HOURis a shorter equivalent.' - Use
ADDTIMEwhen you want to add a literal time duration such as'02:00:00'. - The same interval syntax works in
UPDATEstatements for table columns. - Be explicit about time zones and whether you care about full datetime values or only the time component.

