Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

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