This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 12 - Pages: 1 - Last Post: 18 Jul 21, 00:07 Last Post By: RobM
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Lost in date hell again
Posted: 17 Jul 21, 14:58
 
  Click to reply to this thread Reply
OK, I do this, for a folder:
JAlbumUtilities.getDeepCameraDates(currentObject)
What I'm expecting to get back are two values, each in milliseconds since the dawn of computer time. What I get back, instead, looks like a formatted string:
Mon Feb 13 12:27:26 EST 2012 - Mon Feb 13 12:27:26 EST 2012
So how do I get the long values? Or, to put it more succinctly, how do I get the software to stop doing me "favors?" ;)
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 15:21   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
OK, I do this, for a folder:
JAlbumUtilities.getDeepCameraDates(currentObject)
What I'm expecting to get back are two values, each in milliseconds since the dawn of computer time. What I get back, instead, looks like a formatted string:
Mon Feb 13 12:27:26 EST 2012 - Mon Feb 13 12:27:26 EST 2012
So how do I get the long values? Or, to put it more succinctly, how do I get the software to stop doing me "favors?" ;)
Can you use .getTime() on each date?
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 15:25   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Can you use .getTime() on each date?

Hell, I can't even extract "each date." You would think that the oldest date would be [0] and the newest [1]. Good luck with that. ;)
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 15:38   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
RobM wrote:
Can you use .getTime() on each date?

Hell, I can't even extract "each date." You would think that the oldest date would be [0] and the newest [1]. Good luck with that. ;)

The API is not clear, it could be .first() and .last() or .firstDate(), or … ;)
Wait for David or plunge in to Tiger? Yeah, wait for David ;)
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 16:09   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
The API is not clear....

Heresy! The API, as we all well know, explains everything in clear, straightforward terms. And I'm King Zog of Albania.
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 22:33   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Try
test = JAlbumUtilities.getDeepCameraDates(ao);
test2 = test.last - test.first;
System.out.println(test);
System.out.println(test2);

For a date range of Fri Jan 01 00:00:00 GMT 1904 - Mon Aug 15 13:42:43 BST 2016
it gives
3554109763000
That equates to 112.6229497807 years
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 22:36   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
For interest I got that code from the API for DateRange
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 23:04   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Yes, finally got it working, thank you! Like you, I was trying things like last(), instead of just last.

But now, the tougher question. If I use this in my skins, they'll require jAlbum 24.1 or better, or they'll start returning the file dates when there are no camera dates.
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 23:11   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
Yes, finally got it working, thank you! Like you, I was trying things like last(), instead of just last.

But now, the tougher question. If I use this in my skins, they'll require jAlbum 24.1 or better, or they'll start returning the file dates when there are no camera dates.

Well, you could try item three: Support new Class in new versions, fallback to old class in old versions and decide what to output for the cheap seats. Or just insist on 24.1, if that is too much hassle.
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 23:14   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
BTW, just for a chuckle, try using getRealCameraDate() on an AlbumObject. One could be forgiven for thinking that this would return the camera date, or a zero if there isn't one. You know, parallel to getWhenAdded(). Fat chance. ;)
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 23:16   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Well, you could try item three: Support new Class in new versions, fallback to old class in old versions and decide what to output for the cheap seats. Or just insist on 24.1, if that is too much hassle.

Too much like browser-sniffing by examining user agent strings. Down that path lies madness.
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Lost in date hell again
Posted: 17 Jul 21, 23:59   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Well, you could try item three: Support new Class in new versions, fallback to old class in old versions and decide what to output for the cheap seats. Or just insist on 24.1, if that is too much hassle.

BTW, another reason that can't work. The method has been present for many, many versions, but it was returning an incorrect result, using the file date if no camera date was present. What I would really need to check is the jAlbum version being used. Too messy to screw around with. I'll either require 24.1, or I'll just let the chips fall, and have some users getting the wrong result under one very narrow set of circumstances.
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: Lost in date hell again
Posted: 18 Jul 21, 00:07   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
RobM wrote:
Well, you could try item three: Support new Class in new versions, fallback to old class in old versions and decide what to output for the cheap seats. Or just insist on 24.1, if that is too much hassle.

BTW, another reason that can't work. The method has been present for many, many versions, but it was returning an incorrect result, using the file date if no camera date was present. What I would really need to check is the jAlbum version being used. Too messy to screw around with. I'll either require 24.1, or I'll just let the chips fall, and have some users getting the wrong result under one very narrow set of circumstances.

You stick a note in your manuals. Both as a reminder and a way of telling the user to upgrade jAlbum if it bugs them.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums