The following is a beforeGetValue event handler for a date field. It displays recent posting dates as days of the week. Anything older than a week it displays as the date.

function postdate_beforeGetValue

local nDays 

nDays = date() - this.value 

do case 

case this.value == {} // Blank date 

return "Not posted" 

case nDays < 0 // Date should never be after current date 

return "Error" 

case nDays == 0 // Same date as today 

return "Today" 

case nDays < 7 // Date within the past week 

return cdow( this.value ) 

otherwise // Older date 

return dtoc( this.value ) 

endcase