max(date) or last hour of that day

1159
2
02-10-2017 11:46 AM
WalterDziuba1
New Contributor III

Afternoon,

I have a rest end point that contains 24 hour entries for each day regarding precipitation. But I only need to extract the last hour of that day, or the max(date) value. For example:

2005-01-14 01:00:00
2005-01-14 04:00:00
2005-01-14 05:00:00
2005-01-14 08:00:00

2005-01-14 23:00:00

So in the example above, I only need to extract the last value. 

How does one query the rest end point to extract only that value?

Any help would be appreciated.....Walter

0 Kudos
2 Replies
AbdullahAnter
Occasional Contributor III

Last hour of day or last date for all features?

0 Kudos
AbdullahAnter
Occasional Contributor III

If you want last date for all features just sort descending the field and get the first row value.

but If you want last hour for each day. So I prefer to divide that date field to 2 fields.

create one field for date and other for time.

you can extract values from your original field as following:

use field calculator and type this expression for specific field :

date >>  Left ([Field Name],10)

time >> Right ([Field Name],8)

Use Advanced Sorting. and sort this records depend on date field (days ) first, and time field second , descending for twice.

If you want to extract the records in new table, Use Sort Tool in Arc toolbox Sort—Help | ArcGIS Desktop ,Finally use Summary Statistics Summary Statistics—Help | ArcGIS Desktop and get first row for each day.

0 Kudos