Getting Date and Writing text based off it

Hi,
I am trying to get the date from an excel table (fixed location) and writing a certain text based on that date. For example, the date written in the excel is “January 2019” and from this I want to write “1901A”. Another example would be “February 2019” -> “1902A”. The naming scheme is basically year+month+“A”. Thanks.

Hi,

Datetime.parseexact(“January 2019”,“DDDD yyyy”,system.gobalization.cultureinfo.invariantculture).tostring(“yyMM”)

The above expression will give output as 1901 and you can concatenate with “A”

Hi @anil5,
I tried to use the expression you gave me and replaced the “January 2019” with a String variable that stores the output from a read cell activity.
Datetime.parseexact(fiscalDate,“DDDDyyyy”,system.globalization.cultureinfo.invariantculture).tostring(“yyMM”)
I get an error saying: String was not recognized as a valid DateTime.

Sorry my mistake use MMMM yyyy by replacing DDDDyyyy

1 Like

@anil5,
Thanks it works perfectly now :+1:

Hi,

Try to understand the expression it’s simple and you can use Everytime, and if any doubts will clarify. hi

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.