Converting Month Variable from Number to Text

Post your questions and help other users.

Moderator: Martin

Post Reply
skiptannen
Posts: 82
Joined: 13 Jan 2014 21:39

Converting Month Variable from Number to Text

Post by skiptannen » 21 Mar 2014 13:42

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.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Converting Month Variable from Number to Text

Post by Martin » 21 Mar 2014 17:04

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

skiptannen
Posts: 82
Joined: 13 Jan 2014 21:39

Re: Converting Month Variable from Number to Text

Post by skiptannen » 21 Mar 2014 17:46

Perfect - that's exactly what I was looking for. Thanks for the quick and detailed response, Martin!

Post Reply