cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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