Getting day suffix when using DateTime.ToString()

Hi,
I found code how to do it but problem is how to do in UIPATH.
I believe costume activity is the ans. But i really don’t know how to do that .
Could anyone upload the workflow of it.
VB code:
litDate.Text = DatePart(“dd”, Now) & GetDateSuffix(DatePart(“dd”, Now))

Function GetDateSuffix(ByVal dateIn As Integer) As String

'// returns formatted date suffix

Dim dateSuffix As String = ""
Select Case dateIn
    Case 1, 21, 31
        dateSuffix = "st"
    Case 2, 22
        dateSuffix = "nd"
    Case 3, 23
        dateSuffix = "rd"
    Case Else
        dateSuffix = "th"
End Select

Return dateSuffix

End Function

thanks in advance
Dilip

I think you can use Switch activity in uipath for this.

2 Likes

Thanks @vvaidya. it worked .Your right its quite easy when i tried it.
adding workflow for getting date suffix . :slight_smile:
Main.xaml (11.0 KB)

Or code activity if you’re on community beta.

1 Like

Do you mean the custom activity? If so, true, it is more scalable.

Not custom activity. Starting with 2017.1.6291 you can use the InvokeCode activity. DateSuffix.xaml (5.5 KB)

Of course a Switch is good too as the complexity here is not too high.

Here’s how it looks:

4 Likes

This is a cool feature! when is the Release date of 2017.1? We just upgraded to 2016.2 last week.

For Studio Pro about one month. But it is already out in CE Beta channel if you want to try it.

1 Like

Thanks. Will give a try tomorrow.