A Question regarding date and...

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • A Question regarding date and...

    Hello everyone,
    I've a list of 100 profiles in a table and show 20 everyday.what i want to do is, i want to show todays date on the first few profiles and yesterdays date on the next few profiles and the previous day on the other profiles and so on.This has to follow everyday, that is today i show 1 to 20 and tomorrow 21 to 40 and so on.
    I also want to restrict the following:

    1.Say,I show todays date on the first 6 profiles today.
    2.and when i list 20 profiles tomorrow,i dont want to show tomorrows date on 6 profiles.

    The reason behind this is, if the same user comes to my page everyday and checks the profiles, i dont want the user to get an impression that the first 6 profiles are new everyday.

    well, how should i start with this one??I hope it makes sense with my question.

    Many thanks
    Happiness is a state of mind.
    Change your mind and be happy!

  • #2
    just use a counter for the output and
    PHP-Code:
    echo date("Y-m-d");  // for today
    echo date ("Y-m-d"mktime(0,0,0,date("m"),date("d")-1,date("Y"))); // for yesterday 
    Kissolino.com

    Kommentar


    • #3
      Thats clear.Well, i want to show todays date on the first 6 records and yesterdays date on 4 records and so on.

      and now tomorow:
      I want to show tomorrows date but not on the first 6 records but on 4.
      is that possible?

      Thanks once again
      Happiness is a state of mind.
      Change your mind and be happy!

      Kommentar


      • #4
        why not, just add on day to the actual date
        PHP-Code:
        echo date ("Y-m-d"mktime(0,0,0,date("m"),date("d")+1,date("Y"))); // for tomorrow

        // for a counter just define a loop and conditions like
        $i=1;
        while(
        do_something)
        {
           if(
        $i 4)
           {
              
        // show tomorrow
           
        }
           elseif(
        $i && $i 6)
           {
              
        // show today
           
        }
           else
           {
              
        // show yesterday
           
        }
        $i++;

        you will find additional information how to use mktime() and how to calculate dates here. look for the date- and time-functions.
        Kissolino.com

        Kommentar

        Lädt...
        X