-3

I'm filling data in pdf with using pdfstamper.there is a birthdate i need to be fill. with use of datetime.tostring("dd-MM-yyyy") the date formated as shown in image.

 string birthdate = lead.LeadBioData.BirthDate.Value.ToString("dd-MM-yyyy");
                form.SetField("dob", birthdate);
                form.SetField("dobInAlphabet", "");

the dobInAlphabet form variable for date in characters. how can i get birthdate in character as shown in image ? there is any linq method that can do that?

enter image description here

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Bhavin Varsur
  • 317
  • 1
  • 15

1 Answers1

1

You can use Humanizer for this.

Install-Package Humanizer

With Humanizer, you can do something like this:

var birthDate = lead.LeadBioData.BirthDate.Value;
var datePart = birthDate.Date.ToOrdinalWords();
var monthPart = birthDate.ToString("MMMM");
var yearPart = birthDate.Year.ToWords();
var birthDateString = datePart + " " + monthPart + " " + yearPart;
prinkpan
  • 2,117
  • 1
  • 19
  • 32