Computed date format

Morning all.

In a computed text how can I get today’s date represented in the following format:

Wednesday 4th May 2005

??

Thanks

Steve

Subject: Computed date format

Stephen,

Take a look at the Format/@Format function

eg: @text(@format(@today;“d-mmmm-yy”)) returns “4th May 2005”

You may have to convert the @weekday(@today) to a text value using an @if statement to prefix the date with the day name

HTH

Mike

Subject: RE: Computed date format

@Format doesn’t exist

Subject: Computed date format

date := @Now;

ww := “Sunday” : “Monday” : “Tuesday” : “Wednesday” : “Thursday” : “Friday” : “Saturday”;

w := ww[@Weekday(date)];

dd := “st” : “nd” : “rd” : “th”;

d := @Day(date);

d := @Text(d) + @If( d < 4; dd[d]; dd[4]);

mm := “Jan” : “Feb” : “Mar” : “Apr” : “May” : “Jun” : “Jul” : “Aug” : “Sep” : “Oct” : “Nov” : “Dec”;

m := mm[@Month(date)];

y := @Text(@Year(date));

@Implode(w : d : m : y; " ")

Subject: RE: Computed date format

Cheers Pepe, worked like a charm!

Subject: RE: Computed date format

The example from Pepe will work only as long as your date never falls on the 21st—23rd or on the 31st. If it does your date will show as 21th, 22th, 23th and 31th respectively.

Try replacing that section with this…

dd := “st” : “nd” : “rd” : “th”;

d := @TextToNumber(@ThisValue);

ddd := @TextToNumber(@Right( @ThisValue ; 1 ));

@Text(d) + @If( d < 4; dd[d]; @Contains(“21”:“22”:“23”:“31”; @Text(d)) ; dd[ddd] ; dd[4])

I’m sure this could be simplified even further, but it works for all date ranges. Cheers.