AnsweredAssumed Answered

How to get current timestamp in where clause?

Question asked by geonetadmin on Jan 23, 2012
Latest reply on Dec 31, 2015 by GSheppard-esristaff
Original User: oaoverland

I am trying to build a where clause for a 'make table view' operation in ArcGIS. I have a table that has a date field that has dates in it. I wish to construct a where clause that selects records from the last 6 hours from the current time.  The clause has to be generic, where the clause computes the 6 hours from whatever today's date is without actually entering today's date.

I have tried to use current_date in the clause, but have not succeeded in getting it to work with the timestamp stored in my date field.

I want the clause to look something like this:

'My_Date' > (current_timestamp -6 hours) AND 'My_Date' <= current_timestamp


The underlying database is a file geodatabase, but the plan is to do the same operation on a SQL Express database.

Any inputs on how to get the clause to work is appreciated.

Attachments

Outcomes