DateTime::Format::EraLegis - DateTime converter for Era Legis
 DateTime::Format::EraLegis::Ephem - planetary ephemeris role
 DateTime::Format::EraLegis::Ephem::DBI - default ephemeris getter
 DateTime::Format::EraLegis::Style - customize output styles


 use DateTime::Format::EraLegis;

 my $ephem = DateTime::Format::EraLegis::Ephem::DBI->new(
     ephem_db => 'db.sqlite3');
 my $style = DateTime::Format::EraLegis::Style->new(
     show_terse => 1, lang => 'symbol');
 my $dtf = DateTime::Format::EraLegis->new(
     ephem => $ephem, style => $style);

 my $dt->set_formatter($dtf);


These three modules combined enable DateTime objects to emit date strings formatted according to the Thelemic calendar. The ephemeris provides access to the planetary location of the Sun and Moon keyed by UTC timestamp. The style dictates the specific expression of the of datetime value using a template into which one can place tokens which can be converted into the sign/degree coordinates for the given date. A default style exists and is permutable by boolean attributes.

All three classes are built with Moose and behave accordingly. Method arguments are typechecked and will die on failure. Defaults exist for all attributes. All attributes are read-only and must be assigned at the time of instantiation.


  • DateTime::Format::EraLegis

    • ephem: DT::F::EL::Ephem object. Creates a new DBI one by default.

    • style: DT::F::EL::Style object. Creates a new one by default.

    • format_datetime(DateTime $dt, Str $format): Standard interface for a DateTime::Format package. $format is one of 'plain' or 'raw'. Defaults to 'plain'.

  • DateTime::Format::EraLegis::Ephem (Role)

    • lookup(Str $body, DateTime $dt): Required by any role consumer. $body is one of "sol" or "luna". $dt is the date in question (in UTC!). Returns the number of degrees away from 0 degrees Aries. Divide by thirty to get the sign. Modulo by thirty to get the degrees of that sign.

  • DateTime::Format::EraLegis::Ephem::DBI

    • Consumes DT::F::EL::Ephem role.

    • ephem_db: Filename of the sqlite3 ephemeris database. Defaults to the value of $ENV{ERALEGIS_EPHEMDB}.

    • dbh: DBI handle for ephemeris database. Defaults to creating a new one pointing to the ephem_db database.

  • DateTime::Format::EraLegis::Style

    • template: Assign a custom template value. Variables (enclosed in '{}') include 'ssign' and 'sdeg' for Sol sign and degree, 'lsign' and 'ldeg' for Luna sign and degree, 'dow' for day of the week, and 'year1' and 'year2' for the two docosades. Example:

       "Sol in {sdeg} degrees {ssign}, anno {year1}{year2} era legis"

      Interpolated values get assigned based on the setting of 'lang'.

    • lang: Set the output language, one of latin, english, symbol, poor-latin. Defaults to 'latin'.

    • show_terse, show_deg, show_dow, show_year, roman_year: Flags to direct the style to alter the default template.


The schema for the DBI ephemeris table is very simple and the querying SQL very generic. Most DBI backends should work without issue, though SQLite3 is the only one tested. The schema is:

   body TEXT,               -- one of 'sol' or 'luna'
   time DATETIME,           -- UTC timestamp of shift into degree
   degree INTEGER NOT NULL, -- degrees from 0 degrees Aries
   PRIMARY KEY (body, time)


Please report bugs as issues at:


Clay Fouts <>


Copyright (c) 2012 Clay Fouts

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.