GeneGenie.Gedcom
GeneGenie.Gedcom copied to clipboard
GedcomDate: DateString in Output unchanged?
When repairing Gedcom data I have to modify GedcomDates by setting Date1, Date2 or using gedComDate.ParseDateString(mydatestring). I.e. mydatestring = "9.4.1721" (German localisation and it means 9 APR 1721). Parsing is correct. DateTime1 is filled. But Date1 and DateString is unchanged and output is 2 DATE 9.4.1721 Gedcomvalidator would prefer 2 DATE 9 APR 1721. I found no way to refresh the output values.
Use System.Globalization to avoid cultural date formatting. Convert your text to date and then use .ToString(0 to reformat.
CultureInfo invC = CultureInfo.InvariantCulture;
GedcomChangeDate gedcomChangeDateF = new GedcomChangeDate(database); gedcomChangeDateF.Date1 = Convert.ToDateTime(family.changedate).ToString("d MMM yyyy", invC).ToUpper(); gedcomChangeDateF.Time = Convert.ToDateTime(family.changedate).ToString("hh:mm", invC); gedcomFamilyRecord.ChangeDate = gedcomChangeDateF;