Support » Plugins » Gripe against PHP dates prior to 1969

Viewing 7 replies - 16 through 22 (of 22 total)
  • Glad someone else could use (test) this change. One area I have not fully investigated is whether the RSS feeds aggregate/order properly on these dates. That would be a nice way to tie together historical logs across multiple sites.

    M.

    Thanks MaryE.

    Just wanted to say that I found this thread and MaryE’s hack in June/July 2006. But I was a lurker at that stage.

    In my case, I had 3,600 posts dated between 1788 and present, so a solution was absolutely necessary.

    MaryE’s description is terrific – detailed, accurate & succinct. If you have this problem you should not hesitate to use this hack.

    I have upgraded once before (2.0.4) and again today to 2.0.5; each time I get out my copy of MaryE’s notes and work my way through. Yes, it does take a little longer, but it is a small price to pay if you want this functionality.

    Thanks

    Ted

    absolutely amazing. brilliant. genius even. stupid unix epoch. thank you very much MaryE.

    Gee, I should read this forum more often (thanks for giving me bragging rights to my teenage kid). I’d love to see some examples in the wild, I’ve just been experimenting with reseach my husband’s been doing. Any urls for viewing?

    Other things I’d like to do, let me know if there’s interest … candidates for WP plugins, perhaps?

    1. make a timeline along the design of blogtimes
    2. do something with circa dating – in general, be able to set granlarity of date entry and display
    3. deal with Julian vs. Gregorian dating – possibly tieing to country codes or geourl? – low priority but annoying ’cause I know it’s there as a “gap”.

    While I’ve been using a variety of tools for my websites, I keep coming back to WP as a very simple but powerful tool to get the job done.

    The latest version of another open source CMS has introduced an extension for adodb date libraries. But by the time I get everything set up just the way I want it (particularly getting the taxonomy modules in line with the date settings), I’ve gotten bored with the whole thing. So KUDOS to WP for keeping it simple!!

    MaryE: this is a sorta “stay tuned” thing…. couple of those plugin ideas might be things I’d have a use for…. and give me a bit, I’ll be using the “fix the stupid unix epoch” tweak on a blog (where I’ll need dates in FR parlance – so that’ll be fun n different!).

    I’ll post back here eventually….

    Hi MaryE

    An example in the wild? No worries.
    http://www.navyhistory.org.au/?p=4537
    This is my “earliest” post, it’s dated 5 February 1788.
    If you follow the post’s “date-range” type category, you’ll see quite a few others.

    The post titles (groan) are another problem altogether and we’re working on that.

    FWIW, I’m just playing with permalinks and am bumping up against the 1970 issue again. So if your proposed permalink looks like index/Y/M/D/postname, then the earliest date for Y=1970 AND it spits the dummy – BIG TIME. Not sure whether this is a PHP or Apache issue.

    Anyway, thanks again MaryE
    Ted

    Nice site. I don’t know the specifics of your problem, but I did notice more had to change in 2.03, and the permalinks needed extra attention. From my experience, the following files to be changed:

    * functions.php
    * functions-formatting.php
    * template-functions-general.php
    * template-functions-link.php

    The templating functions seem to be a new twist. I only include adodb_time.inc into functions.php, which are included in the other 3 files.

    The permalinks require a 2 line change to replace strtodate() with code used in other functions elsewhere in WP.

    More specifically, in file template-functions-links there is the following code around line 53:

    $unixtime = strtotime($post->post_date);
    $category = '';
    if ( strstr($permalink, '%category%') ) {
    $cats = get_the_category($post->ID);
    $category = $cats[0]->category_nicename;
    if ( $parent=$cats[0]->category_parent )
    $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
    }
    $authordata = get_userdata($post->post_author);
    $author = $authordata->user_nicename;
    $date = explode(" ",date('Y m d H i s', $unixtime));

    Looking at the first and last line in this fragment — you will be changing these:

    First line to change:
    $unixtime = strtotime($post->post_date);

    ==> change this to the following 2 lines (or it can be 1 line if you don’t like the $m variable):

    $m = $post->post_date;
    $fulltime = adodb_mktime(substr($m,11,2), substr($m,14,2), substr($m,17,2),substr($m,5,2), substr($m,8,2), substr($m,0,4));

    Second line to change:
    $date = explode(" ",date('Y m d H i s', $unixtime));

    ==> change this to the following 1 line:

    $date = explode(" ",adodb_date('Y m d H i s', $fulltime));

    —————————————–

    Don’t know if this solves your problem, but it was definitely a problem for me. Usual disclaimers, base code, back everything up, etc., etc. Also I did a quick eyeballing of the differences, if this and changes in the other 3 files don’t do the trick, I can do a diff on the codebase.

    M.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Gripe against PHP dates prior to 1969’ is closed to new replies.