Asim Manzur wrote:

> #DateFormat(NOW(),"dddd, mmmm d, yyyy")#
>
> the above format display the date
> Monday, July 5, 2004
>
> I want to display like
> Monday, July 5th, 2004

    function NumSuffixFormat(n) {   
    // format numbers with suffix: -st, -nd, -rd, -th
    // Written by Chris Tazewell [EMAIL PROTECTED]
        if (n EQ 1 OR (Len(n) GTE 2 AND Right(n, 1) EQ 1 AND Right(n, 2)
NEQ 11)) {
            n = n&"st";
        } else if (n EQ 2 OR (Len(n) GTE 2 AND Right(n, 1) EQ 2 AND
Right(n, 2) NEQ 12)) {
            n = n&"nd";
        } else if (n EQ 3 OR (Len(n) GTE 2 AND Right(n, 1) EQ 3 AND
Right(n, 2) NEQ 13)) {
            n = n&"rd";
        } else {
            n = n&"th";
        }
        return n;
    }

That should do the trick.

Stephen
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to