Page 1 of 1

Converting Month Variable from Number to Text

Posted: 21 Mar 2014 13:42
by skiptannen
I am new to Automagic (and blown away by how capable it is!) and I am trying to figure out how to convert a month variable from a number to text. In other words, I need to convert "03" to "Mar". The flow I'm trying to create needs to copy a file that has the format "App List Mar 21, 2014.txt".

I saw on the Date Format Pattern page that the L or M symbols can be either text or a number, but I can't figure out how to get anything other than a number. I've searched the forum and played around with the syntax, but I'm not getting anywhere. The syntax I'm currently working with is:

<script>Vartest1="The filename is App List {getDate(),dateformat,L} {getDate(),dateformat,d}, {getDate(),dateformat,yyyy}.txt";</script>

and the output is:

"The filename is App List 3 21, 2014.txt"

Is there a way to convert the number or do I have to do an if/then loop that converts 1 to Jan, 2 to Feb, etc.

Thanks very much in advance.

Re: Converting Month Variable from Number to Text

Posted: 21 Mar 2014 17:04
by Martin
Hi,

You can use MMM as the dateformat pattern to show the textual month abbreviation and MMMM to show the full month name.
Following script should work:
Vartest1="The filename is App List {getDate(),dateformat,MMM} {getDate(),dateformat,d}, {getDate(),dateformat,yyyy}.txt";

Note that Automagic uses the month names provided by Android using the system language.

Regards,
Martin

Re: Converting Month Variable from Number to Text

Posted: 21 Mar 2014 17:46
by skiptannen
Perfect - that's exactly what I was looking for. Thanks for the quick and detailed response, Martin!