min_taken_date and max_taken_date with h:mm:ss possible?

Nov 12, 2011 at 10:48 PM

I was working the whole morning on this problem, but I could not figure it out:

The photosearch in my program works perfectly fine, as long as I use dates, without specifying the time. When I include time like max_taken_date 10/01/2011 6:16:14 PM to min_taken_date  10/01/2011 12:00:00 AM I will get totally strange results:

 

<tfoot></tfoot>
First few photo.datetaken of received photos:
DateTaken
10/02/2011 1:04:01 AM
10/02/2011 12:55:36 PM
10/02/2011 12:56:43 PM
10/02/2011 12:51:32 PM
10/02/2011 12:56:20 PM
10/02/2011 12:55:24 PM
10/02/2011 12:53:14 PM
10/02/2011 12:52:37 PM
10/02/2011 12:50:53 PM
10/02/2011 12:55:35 PM
10/02/2011 12:52:39 PM
10/02/2011 12:56:07 PM
10/02/2011 12:55:05 PM
10/02/2011 12:56:31 PM
10/02/2011 12:47:08 PM
10/02/2011 12:45:02 PM
10/02/2011 12:44:33 AM
10/02/2011 12:43:05 PM
10/02/2011 12:48:20 PM
10/02/2011 12:40:05 PM
10/02/2011 12:46:29 PM
10/02/2011 12:40:30 PM
10/02/2011 12:43:04 PM
10/02/2011 12:33:29 PM
10/02/2011 12:31:40 PM
10/02/2011 12:36:24 PM
10/02/2011 12:31:52 PM
10/02/2011 12:33:14 PM
10/02/2011 12:31:38 PM
10/02/2011 12:38:44 PM
10/02/2011 12:38:31 PM
10/02/2011 12:39:16 PM
10/02/2011 12:35:56 PM
10/02/2011 12:34:59 PM
10/02/2011 12:37:59 PM
10/02/2011 1:14:52 AM
10/02/2011 1:16:27 AM
10/02/2011 1:18:37 AM
10/02/2011 1:16:30 AM
10/02/2011 1:12:25 AM
10/02/2011 1:11:46 AM
10/02/2011 1:16:20 AM
10/02/2011 1:02:34 AM
10/02/2011 1:00:12 AM
10/02/2011 1:04:33 AM
10/02/2011 1:02:45 AM
10/02/2011 1:00:22 AM
10/02/2011 1:00:27 AM
10/02/2011 1:03:34 AM
10/02/2011 12:52:02 AM
10/02/2011 12:52:55 AM
10/02/2011 12:54:43 PM
10/02/2011 12:57:51 AM
10/02/2011 12:51:33 PM
10/02/2011 12:53:45 PM
10/02/2011 12:52:56 AM
10/02/2011 12:57:26 PM
10/02/2011 12:57:38 AM
10/02/2011 12:50:09 AM
10/02/2011 12:53:21 PM
10/02/2011 12:56:22 PM
10/02/2011 12:58:18 PM
10/02/2011 12:57:46 AM
10/02/2011 12:59:49 PM
10/02/2011 12:59:28 AM
10/02/2011 12:53:47 PM
10/02/2011 12:50:44 PM
10/02/2011 12:56:02 PM
10/02/2011 12:57:51 AM
10/02/2011 12:51:13 PM
10/02/2011 12:54:57 AM
10/02/2011 12:57:46 AM
10/02/2011 12:58:19 AM
10/02/2011 12:52:29 PM
10/02/2011 12:52:53 AM
10/02/2011 12:50:53 AM
10/02/2011 12:54:11 PM
10/02/2011 12:59:32 AM
10/02/2011 12:51:23 PM
10/02/2011 12:58:09 PM
10/02/2011 12:51:48 PM
10/02/2011 12:58:21 AM
10/02/2011 12:51:01 AM
10/02/2011 12:59:27 PM
10/02/2011 12:58:15 AM
10/02/2011 12:58:07 PM
10/02/2011 12:58:16 PM
10/02/2011 12:57:55 PM
10/02/2011 12:54:05 PM
10/02/2011 12:50:44 PM

 

I have checked all my time and date formats, but they seem to be ok. I also don't understand, why the pattern changes after a few photos (like in the list above, first the date is of to 1 day, time seems to count down until time switches to PM, after that PM/AM switch all the time.

I am doing a bbox geo query and need to limit the time in order to receive the correct photos. I use PhotoSearchSortOrder.DateTakenDescending to sort from the newest down to the oldest photos in my time boundary.

Anyone who understands this?

Nov 13, 2011 at 12:46 AM

Alright, it gets more confusing every minute. I tried to use the MinUploadDate and MaxUploadDate as delimiters instead of MinTakenDate and MaxTakenDate - this one seems to work better, but still not consistent.

Here is what is confusing me:

Searchquery:
bbox lat 31.5503237522528, long -124.892128160997 (bottom-left),
lat 42.3494598213672, long -113.643028089003 (top-right),
per_page 200
accuracy 16
safe_search 3
content_type 1
sort date-posted-descending

#First Table (below)
min_upload_date 10/1/2011 10:00:00 A
max_upload_date 10/1/2011 4:00:00 P

#Second Table (below)

min_upload_date 10/1/2011 4:00:00 A
max_upload_date 10/1/2011 4:00:00 P 

 

Results for first Query (just the photo.dateposted data):

<tfoot></tfoot>
UploadDate
10/01/2011 3:52:36 PM
10/01/2011 3:57:25 PM
10/01/2011 3:56:44 PM
10/01/2011 3:56:48 PM
10/01/2011 3:56:52 PM
10/01/2011 3:56:17 PM
10/01/2011 3:57:01 PM
10/01/2011 3:56:29 PM
10/01/2011 3:52:43 PM
10/01/2011 3:57:14 PM
10/01/2011 3:49:02 PM
10/01/2011 3:49:09 PM
10/01/2011 3:49:28 PM
10/01/2011 3:45:10 PM
10/01/2011 3:48:20 PM

[...]

<tfoot></tfoot>
UploadDate
10/01/2011 12:26:51 PM
10/01/2011 12:16:06 PM
10/01/2011 12:18:31 PM
10/01/2011 12:17:03 PM
10/01/2011 12:05:03 PM
10/01/2011 11:55:15 AM
10/01/2011 11:51:22 AM
10/01/2011 11:20:31 AM
10/01/2011 11:16:10 AM
10/01/2011 11:16:08 AM
10/01/2011 11:16:16 AM
10/01/2011 11:16:11 AM
10/01/2011 11:16:15 AM
10/01/2011 11:16:12 AM
10/01/2011 11:16:10 AM
10/01/2011 11:16:09 AM
10/01/2011 11:16:14 AM
10/01/2011 11:16:13 AM

 

Perfect! As it should be.. but now look at the 2nd result, with Min_Upload_Date 4.00 AM instead of 10.00 AM:

<tfoot></tfoot>
UploadDate
10/01/2011 3:52:36 PM
10/01/2011 3:57:25 PM
10/01/2011 3:56:44 PM
10/01/2011 3:56:48 PM
10/01/2011 3:56:52 PM
10/01/2011 3:56:17 PM
10/01/2011 3:57:01 PM
10/01/2011 3:56:29 PM
10/01/2011 3:52:43 PM
10/01/2011 3:57:14 PM
10/01/2011 3:49:02 PM
10/01/2011 3:49:09 PM
10/01/2011 3:49:28 PM
10/01/2011 3:45:10 PM
10/01/2011 3:48:20 PM
10/01/2011 3:46:09 PM
10/01/2011 3:44:17 PM
10/01/2011 3:48:07 PM
10/01/2011 3:41:15 PM
10/01/2011 3:45:14 PM
10/01/2011 3:32:39 PM
10/01/2011 3:39:22 PM
10/01/2011 3:34:15 PM
10/01/2011 3:33:08 PM
10/01/2011 3:33:00 PM
10/01/2011 3:32:33 PM
10/01/2011 3:32:45 PM
10/01/2011 3:21:45 PM
10/01/2011 3:23:10 PM
10/01/2011 3:24:36 PM
10/01/2011 3:21:57 PM
10/01/2011 3:22:22 PM
10/01/2011 3:27:16 PM
10/01/2011 3:29:35 PM
10/01/2011 3:24:31 PM
10/01/2011 3:23:59 PM
10/01/2011 3:29:38 PM
10/01/2011 3:21:26 PM
10/01/2011 3:21:47 PM
10/01/2011 3:26:42 PM
10/01/2011 3:21:35 PM
<tfoot></tfoot>
[...]
UploadDate
10/01/2011 2:18:56 PM
10/01/2011 2:15:42 PM
10/01/2011 2:15:14 PM
10/01/2011 2:18:52 PM
10/01/2011 2:18:04 PM
10/01/2011 7:38:56 AM
10/01/2011 7:39:07 AM
10/01/2011 7:31:22 AM
10/01/2011 7:36:24 AM
10/01/2011 7:33:29 AM
10/01/2011 7:20:52 AM
10/01/2011 7:27:07 AM
10/01/2011 7:22:09 AM
10/01/2011 7:28:54 AM

 [...]

<tfoot></tfoot>

UploadDate
10/01/2011 11:16:09 AM
10/01/2011 11:16:14 AM
10/01/2011 11:16:13 AM
10/01/2011 7:50:23 AM
10/01/2011 7:40:35 AM
<tfoot></tfoot>
UploadDate
10/01/2011 7:18:42 AM
10/01/2011 7:11:54 AM
10/01/2011 7:16:30 AM
10/01/2011 2:16:23 PM
10/01/2011 2:19:37 PM
10/01/2011 2:17:06 PM
10/01/2011 2:15:38 PM
10/01/2011 2:19:21 PM
 [...]

 

The results are totally mixed and it is not sorted correctly. Sorry for the long post -I had to show you this..

Nov 13, 2011 at 1:02 AM
Edited Nov 13, 2011 at 1:04 AM

 

Here is the interesting part of the code:

Dim
options As PhotoSearchOptions = New PhotoSearchOptions() Dim maxdate As System.DateTime Dim mindate As System.DateTime options.MinUploadDate = mindate options.MaxUploadDate = maxdate options.SortOrder = PhotoSearchSortOrder.DatePostedDescending options.Accuracy = accurnum
 options.SafeSearch = safesnum
options.ContentType = contenttnum
options.BoundaryBox.MaximumLatitude = maxlat options.BoundaryBox.MinimumLatitude = minlat options.BoundaryBox.MaximumLongitude = maxlong options.BoundaryBox.MinimumLongitude = minlong options.PerPage = perpagenum options.Extras = PhotoSearchExtras.All Dim MaxPhotos As Integer = maxphotosbox Dim QueryName As String = querynamebox Dim runs As Integer Dim AccessTFormat As String = "M/dd/yyyy h:mm:ss tt" Dim run As Integer Dim allPhotos As New List(Of Photo) Dim allPhotos_sich As New List(Of Photo) runs = Math.Round(MaxPhotos / 400) + 1 If runs > 50 Then runs = 50 Try For run = 1 To runs options.MaxUploadDate = maxdate allPhotos.Clear() Dim Photos As PhotoCollection = f.PhotosSearch(options) total = Photos.Total pages = Photos.Pages allPhotos.AddRange(Photos) Dim ii As Integer Dim ii_start As Integer = 2 Dim ii_end As Integer = pages Dim outputfile As System.IO.TextWriter For ii = ii_start To ii_end options.Page = ii Dim PhotosPage As PhotoCollection = f.PhotosSearch(options) allPhotos.AddRange(PhotosPage) If ii * per_page.Text >= 400 Then Exit For End If Next ii For Each photo As Photo In allPhotos i = i + 1 Dim taglist As String = ";" For Each Tag As String In photo.Tags taglist = taglist & Tag & ";" Next Next maxdate = allPhotos.Item(allPhotos.Count - 1).DateUploaded allPhotos_sich.AddRange(allPhotos) If total <= 400 Then Exit For End If Next run Finally 'outputdata End Try

 

 

 

 

 

 

Coordinator
Nov 14, 2011 at 9:00 AM

Unfortunately I've seen the same thing myself with the Flickr API.

I am simply returning the result to you as Flickr returns them to me, so unfortunately there is not a lot I can tell you I'm afraid.

Sam

Nov 14, 2011 at 6:00 PM

Thank you, Sam! Thats answer was worth more than anything to me.

So, if anyone is interested, here is what I found out. The Flickr response for time delimited query is correct, but the order in which the response photos are sorted is mixed. Thats no problem, I solved it with sorting on my site and using the smallest time/date of one response for selecting the maxdate for the next response.
Next thing, Flickr seems to have problems with the results on Page 2+ - I could eliminate all duplicate results and out-of-time-bound photos with just requesting the first Page of each query with a maximum number of 250 Photos/Page. However, this should be taken with caution, since you need a lot of requests and might get your API key blocked.

There is still one odd thing - sometimes, there seems to be some part of the response missing. In this example, I requested all Photos between 10/1/2011 4PM to 10/1/2011 2AM. The sorted response looks good, except that there seem to be 3 hours missing between 8AM and 11AM:

<tfoot></tfoot>
UploadDate
10/1/2011 3:57:25 PM
10/1/2011 3:57:14 PM
10/1/2011 3:57:01 PM
10/1/2011 3:56:52 PM
10/1/2011 3:56:48 PM
10/1/2011 3:56:44 PM
10/1/2011 3:56:29 PM
10/1/2011 3:56:17 PM
10/1/2011 3:52:43 PM
10/1/2011 3:52:36 PM
10/1/2011 3:49:28 PM
10/1/2011 3:49:09 PM
10/1/2011 3:49:02 PM
10/1/2011 3:48:20 PM
10/1/2011 3:48:07 PM
10/1/2011 3:46:09 PM
10/1/2011 3:45:14 PM
10/1/2011 3:45:10 PM
10/1/2011 3:44:17 PM
10/1/2011 3:41:15 PM
10/1/2011 3:39:22 PM
10/1/2011 3:34:15 PM
10/1/2011 3:33:08 PM
10/1/2011 3:33:00 PM
10/1/2011 3:32:45 PM
10/1/2011 3:32:39 PM
10/1/2011 3:32:33 PM
10/1/2011 3:29:38 PM
10/1/2011 3:29:35 PM
10/1/2011 3:27:16 PM
10/1/2011 3:26:42 PM
10/1/2011 3:24:36 PM
10/1/2011 3:24:31 PM
10/1/2011 3:24:22 PM
10/1/2011 3:23:59 PM
10/1/2011 3:23:10 PM
10/1/2011 3:22:22 PM
10/1/2011 3:22:10 PM
10/1/2011 3:21:57 PM
10/1/2011 3:21:47 PM
10/1/2011 3:21:45 PM
10/1/2011 3:21:38 PM
10/1/2011 3:21:35 PM
10/1/2011 3:21:26 PM
10/1/2011 3:19:57 PM
10/1/2011 3:19:40 PM
10/1/2011 3:19:03 PM
10/1/2011 3:18:47 PM
10/1/2011 3:15:09 PM
10/1/2011 3:12:17 PM
10/1/2011 3:09:21 PM
10/1/2011 3:08:27 PM
10/1/2011 3:07:08 PM
10/1/2011 3:06:55 PM
10/1/2011 3:05:04 PM
10/1/2011 3:04:47 PM
10/1/2011 3:04:33 PM
10/1/2011 3:03:29 PM
10/1/2011 3:03:15 PM
10/1/2011 3:02:30 PM
10/1/2011 3:02:23 PM
10/1/2011 3:00:38 PM
10/1/2011 3:00:12 PM
10/1/2011 2:54:19 PM
10/1/2011 2:50:51 PM
10/1/2011 2:45:06 PM
10/1/2011 2:44:32 PM
10/1/2011 2:44:32 PM
10/1/2011 2:44:32 PM
10/1/2011 2:41:20 PM
10/1/2011 2:40:55 PM
10/1/2011 2:38:58 PM
10/1/2011 2:36:58 PM
10/1/2011 2:34:59 PM
10/1/2011 2:34:33 PM
10/1/2011 2:34:33 PM
10/1/2011 2:34:04 PM
10/1/2011 2:33:39 PM
10/1/2011 2:33:11 PM
10/1/2011 2:32:43 PM
10/1/2011 2:32:24 PM
10/1/2011 2:32:14 PM
10/1/2011 2:31:54 PM
10/1/2011 2:31:25 PM
10/1/2011 2:30:58 PM
10/1/2011 2:30:28 PM
10/1/2011 2:30:00 PM
10/1/2011 2:29:35 PM
10/1/2011 2:29:07 PM
10/1/2011 2:28:32 PM
10/1/2011 2:28:04 PM
10/1/2011 2:27:37 PM
10/1/2011 2:27:13 PM
10/1/2011 2:27:11 PM
10/1/2011 2:26:40 PM
10/1/2011 2:26:33 PM
10/1/2011 2:26:17 PM
10/1/2011 2:25:41 PM
10/1/2011 2:25:17 PM
10/1/2011 2:25:10 PM
10/1/2011 2:25:10 PM
10/1/2011 2:25:03 PM
10/1/2011 2:24:39 PM
10/1/2011 2:24:32 PM
10/1/2011 2:24:18 PM
10/1/2011 2:24:07 PM
10/1/2011 2:24:07 PM
10/1/2011 2:23:59 PM
10/1/2011 2:23:46 PM
10/1/2011 2:23:36 PM
10/1/2011 2:23:05 PM
10/1/2011 2:22:35 PM
10/1/2011 2:22:07 PM
10/1/2011 2:21:57 PM
10/1/2011 2:21:41 PM
10/1/2011 2:21:24 PM
10/1/2011 2:21:06 PM
10/1/2011 2:20:55 PM
10/1/2011 2:20:15 PM
10/1/2011 2:19:58 PM
10/1/2011 2:19:45 PM
10/1/2011 2:19:42 PM
10/1/2011 2:19:37 PM
10/1/2011 2:19:33 PM
10/1/2011 2:19:30 PM
10/1/2011 2:19:30 PM
10/1/2011 2:19:26 PM
10/1/2011 2:19:21 PM
10/1/2011 2:19:17 PM
10/1/2011 2:19:12 PM
10/1/2011 2:19:09 PM
10/1/2011 2:19:06 PM
10/1/2011 2:19:02 PM
10/1/2011 2:19:00 PM
10/1/2011 2:18:56 PM
10/1/2011 2:18:52 PM
10/1/2011 2:18:48 PM
10/1/2011 2:18:44 PM
10/1/2011 2:18:41 PM
10/1/2011 2:18:38 PM
10/1/2011 2:18:33 PM
10/1/2011 2:18:31 PM
10/1/2011 2:18:28 PM
10/1/2011 2:18:24 PM
10/1/2011 2:18:17 PM
10/1/2011 2:18:13 PM
10/1/2011 2:18:08 PM
10/1/2011 2:18:04 PM
10/1/2011 2:18:01 PM
10/1/2011 2:17:56 PM
10/1/2011 2:17:51 PM
10/1/2011 2:17:48 PM
10/1/2011 2:17:44 PM
10/1/2011 2:17:39 PM
10/1/2011 2:17:35 PM
10/1/2011 2:17:27 PM
10/1/2011 2:17:23 PM
10/1/2011 2:17:19 PM
10/1/2011 2:17:15 PM
10/1/2011 2:17:11 PM
10/1/2011 2:17:06 PM
10/1/2011 2:17:00 PM
10/1/2011 2:16:59 PM
10/1/2011 2:16:56 PM
10/1/2011 2:16:47 PM
10/1/2011 2:16:44 PM
10/1/2011 2:16:40 PM
10/1/2011 2:16:36 PM
10/1/2011 2:16:32 PM
10/1/2011 2:16:30 PM
10/1/2011 2:16:28 PM
10/1/2011 2:16:23 PM
10/1/2011 2:16:19 PM
10/1/2011 2:16:15 PM
10/1/2011 2:16:13 PM
10/1/2011 2:16:11 PM
10/1/2011 2:16:07 PM
10/1/2011 2:16:03 PM
10/1/2011 2:15:59 PM
10/1/2011 2:15:55 PM
10/1/2011 2:15:51 PM
10/1/2011 2:15:47 PM
10/1/2011 2:15:42 PM
10/1/2011 2:15:38 PM
10/1/2011 2:15:35 PM
10/1/2011 2:15:30 PM
10/1/2011 2:15:24 PM
10/1/2011 2:15:19 PM
10/1/2011 2:15:14 PM
10/1/2011 2:15:09 PM
10/1/2011 2:12:50 PM
10/1/2011 2:12:23 PM
10/1/2011 2:12:13 PM
10/1/2011 2:11:51 PM

[...]

<tfoot></tfoot>
UploadDate
10/1/2011 11:51:22 AM
10/1/2011 11:20:31 AM
10/1/2011 11:16:16 AM
10/1/2011 11:16:15 AM
10/1/2011 11:16:14 AM
10/1/2011 11:16:13 AM
10/1/2011 11:16:12 AM
10/1/2011 11:16:11 AM
10/1/2011 11:16:10 AM
10/1/2011 11:16:10 AM
10/1/2011 11:16:09 AM
10/1/2011 11:16:08 AM
10/1/2011 7:50:23 AM
10/1/2011 7:50:16 AM
10/1/2011 7:49:53 AM
10/1/2011 7:49:53 AM
10/1/2011 7:49:39 AM
10/1/2011 7:49:23 AM
10/1/2011 7:49:01 AM
10/1/2011 7:48:56 AM
10/1/2011 7:48:41 AM
10/1/2011 7:48:27 AM
10/1/2011 7:48:26 AM
10/1/2011 7:48:12 AM
10/1/2011 7:47:41 AM
10/1/2011 7:47:36 AM
10/1/2011 7:47:07 AM
10/1/2011 7:46:41 AM
10/1/2011 7:46:41 AM
10/1/2011 7:46:13 AM


 [...]

 

<tfoot></tfoot>
UploadDate
10/1/2011 2:17:11 AM
10/1/2011 2:16:57 AM
10/1/2011 2:13:40 AM
10/1/2011 2:12:19 AM
10/1/2011 2:11:25 AM
10/1/2011 2:11:13 AM
10/1/2011 2:10:50 AM
10/1/2011 2:08:31 AM
10/1/2011 2:07:34 AM
10/1/2011 2:06:32 AM
10/1/2011 2:06:24 AM
10/1/2011 2:06:15 AM
10/1/2011 2:06:09 AM
10/1/2011 2:04:19 AM
10/1/2011 2:03:53 AM
10/1/2011 2:03:49 AM
10/1/2011 2:01:57 AM

 

No clue so far why this happens.. 
Haven't tried it with DateTaken yet.