cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
KellyT
Level II

Parse Month (in 3 letter abbreviation) from Date Time

Hello,

 

I have a Date Time column containing dates in the following format of (dd/mm/yyy):

01/03/2017  

01/01/2017

01/12/2017

 

How can I use JSL to parse the month so that it would return:

Mar

Jan

Dec

 

Thank you so much for your help

1 ACCEPTED SOLUTION

Accepted Solutions
KellyT
Level II

Re: Parse Month (in 3 letter abbreviation) from Date Time

Hi Craige, 

 

Thank you so much for the help. The original column was in a date time format.  So I ended up using the following JSL code:

 

dt <<  New Column("Month", Formula(Substr( Format( :Date Time, "ddMonyyyy" ), 3, 3 )));

View solution in original post

2 REPLIES 2
Craige_Hales
Super User

Re: Parse Month (in 3 letter abbreviation) from Date Time

It is not clear if your column is a character column or a date-formatted numeric column. Here's a way to get the 3-letter month names from JMP without building a 12-item lookup table:

x=informat("01/12/2017","d/m/y"); // use this if the data is character, creates a date-time value
y=format(x,"ddMonyyyy"); // use this to get a string from a date time: "01Dec2017"
z=substr(y,3,3); // use this to pick out the month: "Dec"

You can also ask the date time value for the day, month, and year parts as numbers:  month(x), day(x), year(x).

 

Craige
KellyT
Level II

Re: Parse Month (in 3 letter abbreviation) from Date Time

Hi Craige, 

 

Thank you so much for the help. The original column was in a date time format.  So I ended up using the following JSL code:

 

dt <<  New Column("Month", Formula(Substr( Format( :Date Time, "ddMonyyyy" ), 3, 3 )));

Recommended Articles