PostgreSQL timestamp > now() - 30s in 2026

If you searched for timestamp > now() - 30s, this is the PostgreSQL-safe version for 2026 workloads. Use explicit interval syntax and consistent UTC storage so short time-window checks stay reliable under traffic spikes and background job retries.

Correct pattern: compare against NOW() - INTERVAL '30 seconds'. If your events are saved as epoch integers, convert units first and avoid mixing seconds and milliseconds in the same query path.

Production-ready PostgreSQL example

SELECT id, created_at, payload
FROM events
WHERE created_at >= NOW() - INTERVAL '30 seconds'
ORDER BY created_at DESC;

Related EpochConverter pages

Compare with the multi-database variant at timestamp now minus 30s guide. Need a live reference value? Open current UTC timestamp. To decode event values during debugging, use Unix timestamp to date.

Need both conversion directions in one place? Open the main epoch converter tool.

Related developer tool

If this query runs in a job loop, validate your schedule with Cron Expression Builder.

Frequently Asked Questions

Is `timestamp > now() - 30s` valid PostgreSQL syntax?

Use `NOW() - INTERVAL '30 seconds'` in PostgreSQL. The shorthand `30s` is not the standard interval format for production-safe SQL.

Which column type should I compare against in PostgreSQL?

Use a proper `timestamp` or `timestamptz` column for direct comparisons. If values are stored as epoch integers, convert them consistently before comparing.

How do I avoid timezone bugs in 2026?

Store event times in UTC, use `timestamptz` where appropriate, and convert for user display only at the UI boundary.

How do I check if epoch values are seconds or milliseconds?

Use digit length as a quick check: 10 digits is typically seconds and 13 digits is milliseconds. Normalize to one unit before SQL comparisons.