Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1.       print("\n\nWelcome $this->first $this->last.");
  2.       print("<hr />");
  3.      
  4.      //get the date
  5.     $suffix = '';
  6.     $date = $this->last_login_date;
  7.     $year = substr($date,0,4);
  8.     $month = substr($date,5,2);
  9.     $day = substr($date,8,2);
  10.    
  11.     if($month == '01')
  12.     {
  13.       $month = 'January';
  14.     }
  15.         else if ($month == '02')
  16.     {
  17.       $month = 'Febuary';
  18.     }
  19.         else if ($month == '03')
  20.     {
  21.       $month = 'March';
  22.     }
  23.         else if ($month == '04')
  24.     {
  25.       $month = 'April';
  26.     }
  27.         //add more to convert numbers into months
  28.    
  29.     if ($day == '01' || $day == '21' || $day == '31')
  30.     {
  31.       $suffix = 'st';
  32.     }
  33.     else if ($day == '02' || $day == '22')
  34.     {
  35.       $suffix = 'nd';
  36.     }
  37.     else if ($day == '03' || $day == '23')
  38.     {
  39.       $suffix = 'rd';
  40.     }
  41.     else
  42.     {
  43.       $suffix = 'th';
  44.     }
  45.  
  46.     echo 'Your last login was  ' . $day . $suffix .' of ' . $month . ', ' . $year;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement