cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Yass
Level I

Get month name so i can display it

I'd like to retrieve the current month's name to display it in my results.

I tried using this function but i get every time the current date in format dd/mm/yyyy  :

current_month = Format(Today(), "Mon");

textbox_result << Set Text(
        "ICT  NOK  %  for " || current_month || " is " || Char(Round(percent_nok_ict, 2)) || "%\!N" ||
        "FCT  NOK  %  for " || current_month || " is " || Char(Round(percent_nok_fct, 2)) || "%"
    );

Yass_0-1720450480071.png

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Get month name so i can display it

You could use Format Pattern

jthi_0-1720450717624.png

 

Names Default To Here(1);

opt1 = Format(Today(), "Format Pattern", "<Month>");
opt2 = Format(Today(), "Format Pattern", "<Mmm>");

show(opt1, opt2);
-Jarmo

View solution in original post

jthi
Super User

Re: Get month name so i can display it

I'm not sure if << Use Locale(0) would work

Names Default To Here(1);

opt1 = Format(Today(), "Format Pattern", "<Month>", << Use Locale(0));

If not you could create conversion list and use that

Names Default To Here(1);

months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

months[Month(Today())];
-Jarmo

View solution in original post

hogi
Level XI

Re: Get month name so i can display it

If you use the English version of JMP, a very nasty workaround:

"use JMP language ..."

hogi_0-1720456171106.png

from the Preferences/Windows Settings.

It will interfere with dozens of other functions (csv import, date in data tables ....)

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Get month name so i can display it

You could use Format Pattern

jthi_0-1720450717624.png

 

Names Default To Here(1);

opt1 = Format(Today(), "Format Pattern", "<Month>");
opt2 = Format(Today(), "Format Pattern", "<Mmm>");

show(opt1, opt2);
-Jarmo
Yass
Level I

Re: Get month name so i can display it

That works perfectly, thank you !
I have a quick follow-up question. I successfully retrieved the month, but it's currently in French. Is there a function in JMP that can translate it to English ?

jthi
Super User

Re: Get month name so i can display it

I'm not sure if << Use Locale(0) would work

Names Default To Here(1);

opt1 = Format(Today(), "Format Pattern", "<Month>", << Use Locale(0));

If not you could create conversion list and use that

Names Default To Here(1);

months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

months[Month(Today())];
-Jarmo
hogi
Level XI

Re: Get month name so i can display it

If you use the English version of JMP, a very nasty workaround:

"use JMP language ..."

hogi_0-1720456171106.png

from the Preferences/Windows Settings.

It will interfere with dozens of other functions (csv import, date in data tables ....)

Yass
Level I

Re: Get month name so i can display it

Thank you! Using Locale(0) worked perfectly.