cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
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 )));