Newbie - date matching on different date fomats

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi,

I am a hazel newbie and want to know how to handle different date formats in my invoices (dd.mm.yyyy, dd-mm-yyyy, yyyy/mm/dd, yyyy/dd/mm, jan/dd/yyyy and so on)

I tested it with File Jugler, a windows software. There is only one token for all differnt date formats. It works pretty good and it works for all invoices with differnt date formats.

Is there a similar feature in hazel to avoid to create a token for any date format?

Sorry for my english.

speedy
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm

You can have multiple conditions for each format. If you re-use the same custom date attribute for each one, you will end up with only one attribute that you have to use in the actions. Basically, the first case to match is the one that gets used later.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hey Mr_Noodle,

first thanks for you fast answere.

I fear I did not understand correct. :oops:

I understand, that I can reuse a token in diffrent actions, but is there one token that's recognizes all formats or do I have to create one for every format?

Can I combine "all" formates in one token?

It would be a lot of work, becaus there are many combinationes. And I would have to repeat them for every supplier Invoice.
This sounds a little bit stupid, so I imagine to be on the wrong path.

THX
Speedy
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm

You would do something like this:

Image

Give your date token a name, and in the first rule, you'll set the format you're looking for:

Image

Then in the second one, add your "My Date" token, choose the Edit Token again, and choose a different format

Image

Then in your actions rules, you can use that one My Date date token to do whatever you want.
rjames86
 
Posts: 7
Joined: Mon Mar 10, 2014 9:38 am

Hey rjames86,
Thank you for your help.

Your answer confirmed my guess. So I have to define any desired format. Then it is not like in file Juggler (Windows software). There is a variable "File Content: Date," which apparently includes "all" possible formats of date.

A question about your example:
Isn't the first variable "My Date" overwritten by the second edit? Or both formats now included???
What format will be used in a 2nd rule, if I reuse "My Date"?

But maybe I have only a brain blockade ...
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm

The first one to match is the value that is used. Since this is "any", it doesn't matter since Hazel will stop evaluating after the first one to match. If it were "all", then the subsequent uses of that attribute would have to match the value of the first one to match, regardless of the pattern set on it.

When you re-use the attribute, it has the format of the original one by default but you can change it. Each instance has a separate format from the others.

Also, Hazel doesn't do automatic detection because date formats are ambiguous. For example, in rjames86's example, it may not work properly for some dates like 01/05/06 which could be May 1, 2006 or May 6, 2001 (in his case, it will pick the first one because that one is matched first).
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you,
I think I understand
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm


Return to Support