Results 1 to 3 of 3

Thread: show some code based on the day of the month.

  1. #1
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default show some code based on the day of the month.

    I currently use this php code of few lines to display text based on the day of week.

    PHP Code:
    $today date("l");

    switch (
    $today) {
      case 
    "Monday" :
        
    $today $monday;
        
    $todaylink $mondaylink;
      break;
      case 
    "Tuesday" :
        
    $today "$tuesday";
        
    $todaylink $tuesdaylink;
      break;
      case 
    "Wednesday" :
        
    $today $wednesday;
        
    $todaylink $wednesdaylink;
      break;
      case 
    "Thursday" :
        
    $today "$thursday";
        
    $todaylink $thursdaylink;
      break;
      case 
    "Friday" :
        
    $today "$friday";
        
    $todaylink $fridaylink;
      break;
      case 
    "Saturday" :
        
    $today $saturday;
        
    $todaylink $saturdaylink;
      break;
      case 
    "Sunday" :
        
    $today "$sunday";
        
    $todaylink $sundaylink;
      break;

    }

    echo 
    $today
    i want to change this to the day of the month??? is this possible with some php code and javascript modifications here and there.

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    It might be best to point you into the right direction.

    First, date("l"); in your script gets the date's day in a full textual representation of the day of the week. So if today is Tuesday (based on your server's time), it will return "Tuesday". With that said, you just need to change the "l" parameter into F. Check this link for more info:
    http://php.net/manual/en/function.date.php

    From there, you can update your switch cases to match what you're trying to do.


    Hope that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    like always... THANK YOU!

    i love DD.

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
  •