Jack Parker
Jack Parker

Reputation: 569

How Do I Query for the Time Portion of a Timestamp in DB2?

Right now I'm trying to check a timestamp column, and find out if the schedule I'm looking at starts at midnight. I don't want to check the date portion.

So far I've tried a few things, but they are all similar to this.

SELECT * FROM schedule_summary
WHERE sche_START_TIME = TIME('00:00:00'); 

Upvotes: 1

Views: 3076

Answers (1)

xQbert
xQbert

Reputation: 35323

time(Sche_START_TIME) = Time('00:00:00')

Convert both to time data types and compare them.

Though you need to be careful if timezones for either component could be different or if you need to account for variances in geographic location and times.

Upvotes: 1

Related Questions