I want to be able to move files if the date in a specific metadata-field is the date of tomorrow. I can use the variable Switch.date to move the files if the date is equal to, before, after or different from the current date, but I want to be able to move the files if the date in that field is the current date +1. Any ideas?
Kind regards
Erik Terkelsen
Filtering on current date +1
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Filtering on current date +1
How about "Switch.date + 86400000" which will add 24 hours to the current date
Filtering on current date +1
It does sound like a good idea, but how do you add the 86400000 sec. when you have a "Single line text with variables" that looks like this:
[Switch.Date:Format=yyyy-M-dd]
[Switch.Date:Format=yyyy-M-dd]
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Filtering on current date +1
For example: [Job.FileCreationDate] > ([Switch.Date] + 86400000)
Filtering on current date +1
Hmm, don't think it will work.
([Switch.Date:Format=yyyy-MM-dd]+86400000)
seems just to return this value
(2011-10-27+86400000)
([Switch.Date:Format=yyyy-MM-dd]+86400000)
seems just to return this value
(2011-10-27+86400000)
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Filtering on current date +1
My statement didn't have the ":Format" option which converts to a string. Can you send me your flow and I'll implement the logic for you?
Dwight Kelly
Apago, Inc.
dkelly@apago.com
Dwight Kelly
Apago, Inc.
dkelly@apago.com
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Filtering on current date +1
Here's the final Javascript expression solution.
var tmwMilli = new Date().getTime() + 86400000; // now + 24hrs in milliseconds
var tmw = new Date();
tmw.setTime(tmwMilli); // now + 24hrs as Date object
var ftime = job.getVariableAsDate("[Metadata.Date:Path=xap:CreateDate]"); // retrieve XMP date
var rtn = false;
if (tmw.getYear() == ftime.getYear() &&
tmw.getMonth() == ftime.getMonth() &&
tmw.getDay() == ftime.getDay()) {
rtn = true; // return true if metadata date == now + 1 day
}
rtn;
I would like to thank CrossRoads support folks for help with an issue I encountered using getVariableAsDate().
Dwight Kelly
Apago, Inc.
dkelly@apago.com
var tmwMilli = new Date().getTime() + 86400000; // now + 24hrs in milliseconds
var tmw = new Date();
tmw.setTime(tmwMilli); // now + 24hrs as Date object
var ftime = job.getVariableAsDate("[Metadata.Date:Path=xap:CreateDate]"); // retrieve XMP date
var rtn = false;
if (tmw.getYear() == ftime.getYear() &&
tmw.getMonth() == ftime.getMonth() &&
tmw.getDay() == ftime.getDay()) {
rtn = true; // return true if metadata date == now + 1 day
}
rtn;
I would like to thank CrossRoads support folks for help with an issue I encountered using getVariableAsDate().
Dwight Kelly
Apago, Inc.
dkelly@apago.com