Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Restrict the bar_${now():format("yyyy/MM/dd/HH/mm/ss/")} , I am putting a directory structure based on the earlier format, it goes on till seconds, how can i restrict it to only yyyy/MM

avatar
Expert Contributor

Hi,

Thanks

My directory in HDFS is yyyy/mm/dd/hh/mm/ss is there any way I can restrict it till month. example yyyy/mm

Thanks

Dheeru

1 ACCEPTED SOLUTION

avatar
Master Guru

@dhieru singh

yeah you can change the format to below

${now():format("yyyyMM")} 

will gives you only year and month.

In addition you make use any combination in EL in date manupulations with now():-

yyyy //gives only the year
MM //month
dd //date 
HH//hours
mm // minutes from time (MM are for month)
ss // seconds SSS //milliseconds

Examples:-

1.year with month

${now():format("yyyy-MM")} 

output:-

2017-10

2.Hour with minute

${now():format("HH:mm")} 

Output:-

16:17

3.year with minutes

${now():format("yyyymm")} 

output:-

201713 //13 because minute from current time stamp

4.year with date

${now():format("yyyydd")}

output:-

201717 //year with today's date

View solution in original post

2 REPLIES 2

avatar
Master Guru

@dhieru singh

yeah you can change the format to below

${now():format("yyyyMM")} 

will gives you only year and month.

In addition you make use any combination in EL in date manupulations with now():-

yyyy //gives only the year
MM //month
dd //date 
HH//hours
mm // minutes from time (MM are for month)
ss // seconds SSS //milliseconds

Examples:-

1.year with month

${now():format("yyyy-MM")} 

output:-

2017-10

2.Hour with minute

${now():format("HH:mm")} 

Output:-

16:17

3.year with minutes

${now():format("yyyymm")} 

output:-

201713 //13 because minute from current time stamp

4.year with date

${now():format("yyyydd")}

output:-

201717 //year with today's date

avatar
Expert Contributor

@Shu I was just reading the docs found out ${now():format('yyyy')}. Thanks for the quick response. Much appreciated.

Dheeru