Tutorial Change Month Number to Month Name
$monthNum = 5;
$monthName = date("F", mktime(0, 0, 0, $monthNum, 10));
$monthNum = 5;
$monthName = date("F", mktime(0, 0, 0, $monthNum, 10));
I had to prepare this a few days ago, but I hope that it’s not too
late. I want to introduce you the pleasant html5 examples for women,
especially on Valentine’s Day, Or 8 March. This is a collection of interactive
hearts and flowers. Trust me – your girlfriend will love it!
<?php
function current_season() {
// Locate the icons
$icons = array(
"spring" => "images/spring.png",
"summer" => "images/summer.png",
"autumn" => "images/autumn.png",
"winter" => "images/winter.png"
);
// What is today's date - number
$day = date("z");
// Days of spring
$spring_starts = date("z", strtotime("March 21"));
$spring_ends = date("z", strtotime("June 20"));
// Days of summer
$summer_starts = date("z", strtotime("June 21"));
$summer_ends = date("z", strtotime("September 22"));
// Days of autumn
$autumn_starts = date("z", strtotime("September 23"));
$autumn_ends = date("z", strtotime("December 20"));
// If $day is between the days of spring, summer, autumn, and winter
if( $day >= $spring_starts && $day <= $spring_ends ) :
$season = "spring";
elseif( $day >= $summer_starts && $day <= $summer_ends ) :
$season = "summer";
elseif( $day >= $autumn_starts && $day <= $autumn_ends ) :
$season = "autumn";
else :
$season = "winter";
endif;
$image_path = $icons[$season];
echo $image_path;
}
?>
<img src="<?php current_season() ?>" alt="" />
<div > <div > name@example.com </div> </div>
$(document).ready(function(){ $('div.field-field-email .field-item').each(function(){ var emailAdd = $(this).text(); $(this).wrapInner('<a href="mailto:' + emailAdd + '"></a>'); }); });
<div > <div ><a href="mailto:%0A%20%20%20%20name@example.com%20%20%20%20"> name@example.com </a></div> </div>
How can I unfocus a textarea or input? I couldn't find a
$('#my-textarea').unfocus(); method?
yes this is the solution:
$('#textarea').blur()
$date_array = explode("/",$date); // split the array
$var_day = $date_array[0]; //day seqment
$var_month = $date_array[1]; //month segment
$var_year = $date_array[2]; //year segment
$new_date_format = "$var_year-$var_day-$var_month"; // join them together
Possibly a more MySQL friendly format in some circumstances./**
* @param string $date (d.m.y, y-m-d, y/m/d)
* @return string|bol
*/
function convertDate($date) {
// EN-Date to GE-Date
if (strstr($date, "-") || strstr($date, "/")) {
$date = preg_split("/[\/]|[-]+/", $date);
$date = $date[2].".".$date[1].".".$date[0];
return $date;
}
// GE-Date to EN-Date
else if (strstr($date, ".")) {
$date = preg_split("[.]", $date);
$date = $date[2]."-".$date[1]."-".$date[0];
return $date;
}
return false;
}
<?php
function build_calendar($month,$year,$dateArray) {
// Create array containing abbreviations of days of week.
$daysOfWeek = array('S','M','T','W','T','F','S');
// What is the first day of the month in question?
$firstDayOfMonth = mktime(0,0,0,$month,1,$year);
// How many days does this month contain?
$numberDays = date('t',$firstDayOfMonth);
// Retrieve some information about the first day of the
// month in question.
$dateComponents = getdate($firstDayOfMonth);
// What is the name of the month in question?
$monthName = $dateComponents['month'];
// What is the index value (0-6) of the first day of the
// month in question.
$dayOfWeek = $dateComponents['wday'];
// Create the table tag opener and day headers
$calendar = "<table class='calendar'>";
$calendar .= "<caption>$monthName $year</caption>";
$calendar .= "<tr>";
// Create the calendar headers
foreach($daysOfWeek as $day) {
$calendar .= "<th class='header'>$day</th>";
}
// Create the rest of the calendar
// Initiate the day counter, starting with the 1st.
$currentDay = 1;
$calendar .= "</tr><tr>";
// The variable $dayOfWeek is used to
// ensure that the calendar
// display consists of exactly 7 columns.
if ($dayOfWeek > 0) {
$calendar .= "<td colspan='$dayOfWeek'> </td>";
}
$month = str_pad($month, 2, "0", STR_PAD_LEFT);
while ($currentDay <= $numberDays) {
// Seventh column (Saturday) reached. Start a new row.
if ($dayOfWeek == 7) {
$dayOfWeek = 0;
$calendar .= "</tr><tr>";
}
$currentDayRel = str_pad($currentDay, 2, "0", STR_PAD_LEFT);
$date = "$year-$month-$currentDayRel";
$calendar .= "<td class='day' rel='$date'>$currentDay</td>";
// Increment counters
$currentDay++;
$dayOfWeek++;
}
// Complete the row of the last week in month, if necessary
if ($dayOfWeek != 7) {
$remainingDays = 7 - $dayOfWeek;
$calendar .= "<td colspan='$remainingDays'> </td>";
}
$calendar .= "</tr>";
$calendar .= "</table>";
return $calendar;
}
?>
To print a table of May 2005, just do:
<?php echo build_calendar(05,2005); ?>
And you'll get a table like this:
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |