Showing posts with label Source code. Show all posts
Showing posts with label Source code. Show all posts

Thursday, July 16, 2015

PHP: function: isToday_new

// 今日か?
function isToday_new($y, $m, $d)
{  
   if (date('Y-m-d') == date ('Y-m-d', strtotime($y . "-" . $m . "-" . $d)))
   {
      $retval = true;
   }
   
   return $retval;
}

PHP: function: monthENtoJP

// 月を英語から数値へ
function monthENtoJP($en)
{
   $monthENtoNum = array(
      "Jan" => 1 , 
      "Feb" => 2 , 
      "Mar" => 3, 
      "Apr" => 4, 
      "May" => 5, 
      "Jun" => 6, 
      "Jul" => 7, 
      "Aug" => 8, 
      "Sep" => 9, 
      "Oct"=> 10, 
      "Nov" => 11, 
      "Dec" => 12);

   return $monthENtoNum[$en];
}

PHP: function: weekdayENtoJP

// 曜日を英語から日本語へ
function weekdayENtoJP($en)
{
   $weekdayENtoJP = array(
      "Sun" => "日",
      "Mon" => "月",
      "Tue" => "火",
      "Wed" => "水",
      "Thu" => "木",
      "Fri" => "金",
      "Sat" => "土");

   return $weekdayENtoJP[$en];
}