Fixing Dates and Date Phrases

Introduction

Many other programs allow arbitrary formats for dates, which Family Historian will often interpret as Date Phrases, which can easily be recognised as they are shown in quotation marks. Using plugins it is possible to correct the majority if they are consistently formatted.

Getting Started

A good place to start is to download and run the Find Date Phrases plugin. If it only lists a few Date Phrases in its Result Set, it is normally a quick job to double click on the Date column items to jump to the Date fields and correct them.

Correcting Dates with "Fix Date Fields"

Fix Date Fields

Download and run the Fix Date Fields plugin.

Use the List option to see what might get fixed.

Then after creating a backup, use the Mend option.

If any Dates are still NOT FIXED then ask for assistance in the Forums or try the techniques below.

Correcting Dates with a Custom Plugin

Open the Tools > Plugins window and click the More» button, select the Fix Date Fields plugin, and click Edit. Then use the File > Save As option to save the plugin with a new Plugin Name such as Fix Date Phrases.

Reviewing the code you will find a table of conversion codes around lines 250 to 280. These use LUA Patterns to define the Date to be detected and its replacement. Simply copy & paste one of the existing lines and change the patterns. Ask for help in the Forums if you cannot figure out what is needed.

Correcting Dates with "Search and Replace"

Date fields can be corrected using the Search and Replace plugin, but does require an understanding of LUA Patterns.

Run the Search and Replace Plugin:

  • Ensure LUA Pattern Mode is selected top right.
  • Ensure Search Scope: is All Records & Events/Attributes.
  • In Basic Filters untick every option except Date fields.
  • Enter LUA Patterns into the Search and Replace boxes based on the examples below.
  • Click Search & Replace button, and click Replace button to confirm each change.
  • When satisfied the changes are OK, untick Confirm every item found and click Replace once.
  • When complete a Result Set of changes is listed.
  • Double-click any new Date to open its Property Box.

BET Day AND Day Month Year

Search: between 00(%d%d) and (%d+) (%a+ %d%d%d%d)
Replace: between %1 %3 and %2 %3

"BET Day Month AND Date"

Search: "BET (%d- ?%a+) AND (.-) (%d%d%d%d)"
Replace: between %1 %3 and %2 %3

"BET Date AND Date"

Search: "BET (.-%d%d%d%d) AND (.-%d%d%d%d)"
Replace: between %1 and %2

"Day-Day Month Year"

Search: "(%d+)%-(%d+) (%a+ %d%d%d%d)"
Replace: from %1 %3 to %2 %3