|
Replies:
12
-
Pages:
1
-
Last Post:
18 Jul 21, 00:07
Last Post By: RobM
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Lost in date hell again
Posted:
17 Jul 21, 14:58
|
|
|
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?"
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 15:21
in response to: JeffTucker
|
|
|
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?
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 15:25
in response to: RobM
|
|
|
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.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 15:38
in response to: JeffTucker
|
|
|
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
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 16:09
in response to: RobM
|
|
|
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.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 22:33
in response to: JeffTucker
|
|
|
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
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 22:36
in response to: RobM
|
|
|
For interest I got that code from the API for DateRange
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 23:04
in response to: RobM
|
|
|
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.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 23:11
in response to: JeffTucker
|
|
|
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.
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 23:14
in response to: JeffTucker
|
|
|
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.
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 23:16
in response to: RobM
|
|
|
Too much like browser-sniffing by examining user agent strings. Down that path lies madness.
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Lost in date hell again
Posted:
17 Jul 21, 23:59
in response to: RobM
|
|
|
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.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Lost in date hell again
Posted:
18 Jul 21, 00:07
in response to: JeffTucker
|
|
|
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
|
|