PhpDig.net

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




jdtofrench

Name

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

Synopsis

string jdtofrench(JD);
int JD: Julian day count

Returns

French Republican Calendar date; 0/0/0 if an invalid Julian day count is specified

Description

jdtofrench() converts a Julian day count to a French Republican cCalendar date string. The returned date string is formatted as MM/DD/YY.

Valid Julian day counts for this function range from2375840 to 2380952. If a count outside this range is specified, the function returns 0/0/0.

Version

PHP Version: 3+, 4+

See also

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

frenchtojd()

To get a Julian day count from another calendar system, see the various *tojd() functions.

Example

Example 75. Convert a Gregorian date to a textual French Republican Calendar date

<?php
function gregorian_to_french ($year, $month, $date) {
    // Define start and end dates for the French Republican Calendar
    $frc_start = gregoriantojd (9, 22, 1792);
    $frc_end   = gregoriantojd (9, 22, 1806);

    // Convert date to a Julian day count
    $date_to_convert = gregoriantojd ($month, $date, $year);

    // Ensure that the date to be converted is within the start and end dates
    if ($date_to_convert < $frc_start || $date_to_convert > $frc_end)
        return FALSE;

    // Define month names
    $month_names = array (
        1 => 'Germinal', 2 => 'Flor&eacute;al', 3 => 'Prairial', 4 => 'Messidor',
        5 => 'Thermidor', 6 => 'Fructidor', 7 => 'Vend&eacute;miaire', 8 => 'Brumaire',
        9 => 'Frimaire', 10 => 'Niv&ocirc;se', 11 => 'Pluvi&ocirc;se', 12 => 'Vent&ocirc;se',
        13 => 'Compl&eacute;mentaire / Festival de Sans-culottides'
    );

    $frc_date = jdtofrench ($date_to_convert);
    list ($month, $date, $year) = explode ('/', $frc_date);
    return "$month_names[$month] $date, $year";
}

echo gregorian_to_french (1799, 9, 22);
?>



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.