Results 1 to 4 of 4

Thread: date format issue, says 1970 always :(

  1. #1
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default date format issue, says 1970 always :(

    Hey,

    I am trying to format a date, its not a timestamp, basically you select the day, month and year from a drop down and its put in to the database in 3 seperate fields..

    so if i do
    Code:
    $datef = "$date_day"."$date_month"."$date_year" ;
    then echo $datef it displays right (17082007)

    now i try and format the output, and its wrong..
    Code:
    $date = date("jS F Y", $datef);
    i get 17th February 1970

    any ideas?

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try:
    Code:
    $date = date("jS F Y");
    echo $date;
    and see what it outputs.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi, try this:

    Code:
    echo date( 'jS F Y', mktime( 0, 0, 0, $date_month, $date_day, $date_year );

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Why are you storing it in this inefficient format instead of your database's native date type?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •