Split date string in PHP

Jimmy Wales Reply 11:56
split - Split string into array by regular expression

for Example :
Parse a Date which may b delimited with dots, hypens or slashes-

<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />\n";
?>

2nd Example :-

<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);

//  - convert number to month name
$monthNum  = $month;
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10)); // March
echo $monthName .' '.$day .', '. $year ;
?>






Scroll to the Bottom and Top of a page with jQuery

Sangwan Pankaj Reply 12:12


This Javascript code will scroll the page bottom
$('html, body').animate({scrollTop:$(document).height()}, 'fast'); 
and change your speed as required in numerical or slow , fast. Here we use fast in example
And create jQuery function 
$(document).ready(function() {     
 $('#yourId').click(function(){
       $('html, body').animate({scrollTop:$(document).height()}, 'fast');
        return false;  });
}); 
And for body part 
Use a link to an anchor tag e.g. <div id="yourId"> or <a href="#yourId"> 
Put this code in Header part:-
(Complete Code)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
 function bottomScroll() {
  $('html, body').animate({scrollTop:$(document).height()}, 'fast');
 }
 function topScroll() {
  $('html, body').animate({scrollTop:0}, 'fast');
 }
</script>
 
Put this code in Header part:-

 <a href="javascript:bottomScroll()">Bottom Scroll</a>
 <a href="javascript:topScroll()">Top Scroll</a> 
 



Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us