Thursday, 10 March 2011

Months as text

Below is some useful code I have used many times.  This allows you to take a date field and display the month of the field.  I have used this in categorised columns many times for many years.  You have to make sure that if the month number is less than 10 that you prepend a "0", otherwise the month of 11 would become "JanuaryJanuary". 

tmpDate:= @Month(StartDate); 
tmpTxtDate:= @If(tmpDate<9;"0"+@Text(tmpDate);@Text(tmpDate)); 
tmpMonths := "January":"February":"March":"April":"May":"June":"July":"August":"September":"October":"November":"December";
tmpNum := "01":"02":"03":"04":"05":"06":"07":"08":"09":"10":"11":"12"; 


No comments:

Post a Comment