WordPress.org

Ready to get started?Download WordPress

Forums

date missing the day (12 posts)

  1. danithew
    Member
    Posted 9 years ago #

    I noticed suddenly today that my dates are missing the month. I have formatted the date so that it should look like this: 31 July 2004 (Saturday)
    It is showing up as 31 2004 Saturday.
    I am wondering if anyone else is experiencing this or if perhaps this is a bug I am getting due to the host I am using? I'm not quite sure what to make of this. It may be an error that will suddenly be corrected tomorrow due to a bug in the system(?)

  2. davidprince
    Member
    Posted 9 years ago #

    Have you double checked how your dates should appear under Options ->General (Default Date Format).
    Sorry if that is really simplistic but it might help narrow it down.

  3. danithew
    Member
    Posted 9 years ago #

    I did double-check how the date should appear in options and it shows up in the correct manner there. The problem must be coming from somewhere else.

  4. codergurl
    Member
    Posted 9 years ago #

    Do you have something like this for the formatting? d F Y l

  5. danithew
    Member
    Posted 9 years ago #

    My formatting is:
    j F Y (l)

  6. danithew
    Member
    Posted 9 years ago #

    I just figured out that this code I had in the my-hacks file is somehow causing the month to disappear from the dates over my posts. Here is the code I was using.
    < ?php
    $today = date( “j� );
    $month = date( “n� );
    if ( $month 4 || $month 6 || $month 9 || $month 11 )
    {
    $max = 30;
    }
    else if ( $month 2 )
    {
    $max = ( date( “L� ) 1 ) ? 29 : 28;
    }
    else
    {
    $max = 31;
    }
    $left = ( $max – $today );
    $left = ( $left == 1 ) ? “is $left day� : “are $left days�;
    ?>
    Maybe someone can help me to get this monthly countdown to work without having that effect on my dates.

  7. Root
    Member
    Posted 9 years ago #

    $max at 32?

  8. Beel
    Member
    Posted 9 years ago #

    If it is working properly, I wouldn't change that. You can change the variable names so they do not interfere elsewhere (like $month becomes $cd_month)

  9. danithew
    Member
    Posted 9 years ago #

    I'll give that a try and see how it works. Thanks Beel.

  10. danithew
    Member
    Posted 9 years ago #

    I tried this:
    <?php
    $today = date( "j" );
    $cd_month = date( "n" );
    if ( $cd_month == 4 || $cd_month == 6 || $cd_month == 9 || $cd_month == 11 )
    {
    $max = 30;
    }
    else if ( $cd_month == 2 )
    {
    $max = ( date( "L" ) == 1 ) ? 29 : 28;
    }
    else
    {
    $max = 31;
    }
    $left = ( $max - $today );
    $left = ( $left == 1 ) ? "is $left day" : "are $left days";
    ?>
    It just created a bunch of error messages.

  11. danithew
    Member
    Posted 9 years ago #

    I was trying to change the $month to $cd_month wherever it appeared in the code. I thought that was what you were suggesting.

  12. danithew
    Member
    Posted 9 years ago #

    Here's a code that works. I believe it operates on the same principle Beel was talking about, though the change made was a little different.
    <?php
    $today = date( "j" );
    $ht_month = date( "n" );
    if ( $ht_month == 4 || $ht_month == 6 || $ht_month == 9 || $ht_month == 11 )
    {
    $max = 30;
    }
    else if ( $ht_month == 2 )
    {
    $max = ( date( "L" ) == 1 ) ? 29 : 28;
    }
    else
    {
    $max = 31;
    }
    $left = ( $max - $today );
    $left = ( $left == 1 ) ? "is $left day" : "are $left days";
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.