Ordinal Date Suffix

1st, 2nd, 3rd, 4th, etc...
Lotus Formula • LotusScript

Formula

ordinal := "<sup>"+ 
		@If(
			@Day(tmpdate) = 1; "st";
			@Day(tmpdate) = 2; "nd";
			@Day(tmpdate) = 3; "rd";
			@Day(tmpdate) = 21; "st";
			@Day(tmpdate) = 22; "nd";
			@Day(tmpdate) = 23; "rd";
			@Day(tmpdate) = 31; "st";
			"th"
		) + 
		"</sup>";

LotusScript

Function OrdinalDateSuffix(datein As variant) As String
	
	Dim tmp As String
	tmp = Format(datein, "d")

	Dim ordinal As string
	Select Case tmp
		Case "1"		: 	ordinal = "st"
		Case "2"		: 	ordinal = "nd"
		Case "3"		: 	ordinal = "rd"
		Case "21"		: 	ordinal = "st"
		Case "22"		: 	ordinal = "nd"
		Case "23"		: 	ordinal = "rd"
		Case "31"		: 	ordinal = "st"
		Case Else		:	ordinal = "th"
	End Select

	'output
	OrdinalDateSuffix = "<sup>" & ordinal & "</sup>"
	
End Function

Written by fbrefere001

Posted by fbrefere001 on Wednesday December 11, 2019