PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




frenchtojd

Name

frenchtojd — Converts a French Republican Calendar date to Julian day count.

Synopsis

int frenchtojd(month, day, year);
int month: French Republican Calendar month number
int day: French Republican Calendar day of month
int year: French Republican Calendar year

Returns

Julian day count; 0 if any parameter falls outside the valid range

Description

frenchtojd() converts a French Republican Calendar date to a Julian day count. If any of the function arguments falls outside the acceptable range, the function returns 0.

The following table shows the acceptable ranges for the parameters of this function.

Parameter Acceptable Range of Values
month 1 to 13
day 1 to 30
year 1 to 14


Note

The French Republican Calendar was developed around the time of the French Revolution to provide a rational and secular alternative to the Gregorian calendar. The attempt was beautiful, rendering a calendar that was sensible, lyrical, and, for the time, humanist. The calendar's epoch (start) was calculated from the day that the Republic was proclaimed (September 22, 1792). The calendar was not put into use until November 24, 1793, and only remained in use until the end of 1805. Additional resources on this interesting calendar (and time in French history) can be found on the Internet - a simple search for French Republican Calendar should bring up an abundance of reference material. Alternatively, check your local library for resources.

Version

PHP Version: 3+, 4+

See also

To convert a Julian day count to a French Republican Calendar date:

jdtofrench()

To convert a Julian day count to another calendar system, see the other jdto*() functions.

Example

Example 69. Convert a French Republican Calendar date to a Gregorian date

$frc_date = frenchtojd (10, 5, 9);
echo jdtogregorian ($frc_date);

Example 70. Convert a French Republican Calendar month name or numeral to its numeric equivalent

/*
   Here is a little bonus script that converts FRC month names and Roman numerals to their 
   numeric equivalents. Enjoy!
*/

function frc_month_convert ($month) {
       $months = array (
           // The months of Spring
           'I' => 'germinal', 'II' => 'flor.{1,8}al', 'III' => 'prairial',
           // The months of Summer
           'IV' => 'messidor', 'V' => 'thermidor', 'VI' => 'fructidor',
           // The months of Autumn
           'VII' => 'vend.{1,8}miaire', 'VIII' => 'brumaire', 'IX' => 'frimaire',
           // The months of Winter
           /*
           Note the regular expression syntax within the month names
           They allow the function to accommodate a wide variety of escape sequences
           (Such as HTML/XML/SGML and even simple TEX)
           */
           'X' => 'niv.{1,8}se', 'XI' => 'pluvi.{1,8}se', 'XII' => 'venti.{1,8}se',
           // Complementary or feast days at the end of the year
           'XIII' => '(compl.{1,8}mentaire|sans.culottides'
       );

       // Clear out any nasty whitespace
       $month = trim ($month);

       for ($month_no = 1; list ($numeral, $name) = each ($months); ++$month_no)
           if (strtoupper ($month) == $numeral || preg_match ("/$name/i", $month))
               return $month_no;
}

echo frc_month_convert ('X') . '<br />';
echo frc_month_convert ('Vendimiaire') . '<br />';
echo frc_month_convert ('Pluvise ') . '<br />';



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.