Date Formats, Current/Historical Mode, LAMP env

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • awebguynow

    Date Formats, Current/Historical Mode, LAMP env

    I'm working in a Lamp environment, (actually WAMP), am using one of the
    many Calendar widgets (that has configurable formats), and have a heavy
    data in/data out (forms/reports) webapp.

    This is probably more of a design issue, than PHP issue, but we all
    deal with this.
    My 1st priority has been for simplicity, so I have used std. MySQL
    format for the text input that feeds into the table.Column.

    There are problems with that and I'd like to find out what better
    choices may be available.
    Obviously, choosing another format for forms-reports would require
    manipulation of date to/from DB. What is the best way this be
    implemented with consistency ?

    I have considered saving space on the screen by working with implied
    years but this seems destined to prove a headache no matter what. YY
    format would be ambiguous in a decade. Mode System: Current or
    Historical ? Use OO or switch() to present Xhtml reports
    differently. Can it be made to change modes automatically ?

    Anyone else have this ? or have the answers to handle this (one of
    Life's persistent questions)

  • NC

    #2
    Re: Date Formats, Current/Historical Mode, LAMP env

    awebguynow wrote:
    >
    My 1st priority has been for simplicity, so I have used
    std. MySQL format for the text input that feeds into the
    table.Column.
    >
    There are problems with that
    The only real problem is that MySQL supports wider range
    of dates than PHP does. The rest is a matter of convention.
    Obviously, choosing another format for forms-reports
    would require manipulation of date to/from DB. What
    is the best way this be implemented with consistency ?
    function date2date($stri ng, $format = 'Y-m-d') {
    $ts = strtotime($stri ng);
    if ($ts == -1) {
    return false;
    } else {
    return date($format, $ts);
    }
    }

    To convert a string representation of a date into the MySQL
    format, call

    date2date('Sept ember 25, 2006');

    To present the date retrieved from MySQL in the format of
    yout choice, call

    date2date($date _from_MySQL, 'Format of your choice');
    Mode System: Current or Historical ?
    I'm afraid I don't understand what this means... Would you
    care to elaborate?

    Cheers,
    NC

    Comment

    Working...