steph072 Regardless I'm in Europe oder in US. When I shot a sunrise at 6am, the sunrise is at 6am as example, not at 12pm. So looking at the picture I want to know it was taken at 6am.
My picture in Carribean was taken at 6.10am at sunrise. At 8.10am the sun is already high and this is inconsistant.
Yep, I understand your scenario also, but this does not suit everyone.
I did some tests, and it seems this photo was taken in the Caribbean? I have checked the EXIF of this photo:
DateTimeOriginal 2013-04-14 06:10:19 +0000
As you can see, the photo is stored with timezone +0000, or probably in your case assuming no timezone. For many applications, they will assume the time is GMT of course. I checked what your photo looks like on Google Photos:
It's wrong of course, because it's adding some offset based on GPS location it seems. So Google does it their way, and that's wrong for you also. In either case, it can't know for sure unless the EXIF date is consistent.
steph072 I run another gallery software and there is no problem.
Perhaps this program simply prints the exact output from DateTimeOriginal, but ignores the timezone +0000 (which in your case was wrong, if the image was taken in Guadeloupe), and ignores viewer timezone also. This would work in your case, but it's not useful for example from an iPhone photo, where the correct time, time zone and geo location are stored with the image.
How does this application sort images by date if one photo was taken at 07:00 in Tokyo, and another 12 hours later at 06:00 in New York? Should the photo in New York then be listed as newer/latest although it's 12 hours after the photo from Tokyo? Simply printing out the dateTimeOriginal is one thing, but it's useless for sorting if we don't know or can't assume the actual absolute time it was taken.
steph072 I'm not able to program in PHP but I will try to understand the way your program works.
There is currently line
return (new DateTime($str, new DateTimeZone('UTC')))->getTimestamp();
We need to convert the date to a pure number unix time stamp, so that it can be used for sorting dates. Unix time stamp is SECONDS SINCE JAN 01 1970 (UTC), so dates are always absolute. If we don't convert to UTC, then the date will be wrong of course. So for this to work correctly, we need to assume the time (and timezone) in the photo is assigned correctly (with +0000 timezone offset).
Even if you remove
new DateTimeZone('UTC'), it would return the same value in your case, because the time looks like it's stored in +0000 GMT anyway. The EPOCH TIME will then return
1365919819 which is the amount of seconds since Jan 01 1970 (UTC), but in your case it would be wrong.
Anyway, I need to think about this, but we need options. It's not right to just print the exif date stamp for all photos, if the user actually wants to know exactly when it was taken. For your photo, the visitor doesn't really know, except "06:10:19 at whatever location the photographer was in".