-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
  • 96,782
  • 12
  • 124
  • 169
Bhavin Varsur
  • 197
  • 11

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;
Priyank Panchal
  • 1,894
  • 1
  • 20
  • 27