SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: JDToGregorian

  1. #1
    SitePoint Addict rwar's Avatar
    Join Date
    Sep 2001
    Location
    PF / RS / BR
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JDToGregorian

    I've tried to use this function, but what returns is a strange value. I'd like to know the date in a specific year. For example:

    PHP Code:
    $date 300;

    print(
    jdtogregorian($date)); 
    returns 9/19/-4713 in the format of month/day/year

    In fact the year is the strange value. How can I get an year after 1900 with this function? Can some help?

    Thanks.
    php? mysql? apache? That's it.

  2. #2
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The gregoriantojd() function takes month, day and year as arguments and returns a Julian Day Count value.
    Code:
    echo gregoriantojd(1, 1, 1900);
    gives us a value of 2415021. So
    Code:
    echo jdtogregorian(2415021);
    will therefore give us a value of "1/1/1900".

    - Marshall

  3. #3
    SitePoint Addict rwar's Avatar
    Join Date
    Sep 2001
    Location
    PF / RS / BR
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Marshall.

    I didn't not think this way you did. It's a good one. The problem (I'm resolving) is that I have a date like this:

    61001 ...<another information>
    61002 ...<another information>
    61003 ...<another information>
    ...
    61363 ...<another information>
    61364 ...<another information>
    ...
    90001 ...<another information>
    90002 ...<another information>

    where the first two digits shows the year of the date and the rest (a day number) shows the day IN the respective year. My boss is getting me crazy with that stuff.

    Thanks for your help again.
    php? mysql? apache? That's it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •