Monday 30 September 2019

A Trip To Hyderabad & Mallikarjuna Jyotirlinga | Part 2 | Telangana And Andhra Pradesh | Homecoming




After visiting the main place "Mallikarjuna Jyotirlinga", we packed our bags, completely exhausted and went for our first destination to go home, that is, Hyderabad. One of our friend have some friends who live in Hyderabad. We met them, and they helped us exploring the city. The main thing that I was excited about is "Chicken Biryani". After that, we went to hotel, spent night and next day, we catch train. We had fun dancing in train as we always do. Then we reach PUNE and then catch the bus to reach MUMBAI.

Monday 16 September 2019

PHP Tutorial | Navigate To Next And Previous Week & And Get Dates Within Week











Code : navigate_week.php
<center>


<a href="navigate_week_tutorial.php">Refresh</a>
<br/>
<?php
$week=0;
if(isset($_GET['week_count']))
{
$week=$_GET['week_count'];
}
else
{
$week=date('w');
}
echo "Today's Date :".date('Y-m-d'). " | Day : ".date('D');
echo "<br/>";
echo "First day of week : ".$week_first_date=date('Y-m-d',strtotime("-".(0+$week)." days"));
echo "| Day : ".date('D',strtotime($week_first_date));
echo "<br/>";
echo "Last day of week : ".$week_last_date=date('Y-m-d',strtotime("+".(6-$week)." days"));
echo "| Day : ".date('D',strtotime($week_last_date));
echo "<br/>";
$next_week_var=intval($week)-7;
$previous_week_var=intval($week)+7;
?>


<a href="navigate_week_tutorial.php?week_count=<?php echo $previous_week_var;?>"> << Previous Week</a> 

OR

<a href="navigate_week_tutorial.php?week_count=<?php echo $next_week_var;?>">Next Week >> </a>
<br/>
<?php
for($i=0;$i<=6;$i++)
{
echo $temp_date=date('Y-m-d',strtotime($week_first_date."+".$i." days"));
echo "| Day : ".date('D',strtotime($temp_date));
echo "<br/>";
}
?>
</center>

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/



 Hello guys.
In this tutorial, we
shall discuss how to navigate to each week, how to set range of
weekdays like from monday to sunday, or sunday to saturday, or any
from and to days you want ,and also how to get days of each week.
For example, let say
the current day is 15 sept 2019, so the range will always be of 7
days. But we get days from wednesday to tuesday.
We can also navigate
to next weeks or previous weeks and get dates between them.
So lets get started.
We shall build code
from the scratch.

First we shall get today’s date and day.
Next, I am going to
add refresh link, it’s purpose will be revealed later.
New we shall find
the week-day count using this code.
By using this, we
shall get first day and last of every week.
For first day, we
are using “minus” symbol in strtotime function.
And for last day of
week, we shll use plus sign.
Let get, which day
it is.
Now we shall find
all days between two days by using for loop.

Let make it on
center.
Now we shall add
week navigation, so fot that we have to find two numbers, for next
week and last week.
For previous week,
there will be + 7.
In href, we shall
make a variable called week count. And assign value for previous and
next week.
Now, even when
clicked on link, it doesn’t do anything.
So we have to
overwrite the $week value.
Let test
it.

Acutally I made a mistake in a code.
Ok, so you just have
to add + instead of minus at “Week first date”.
Lets refresh and
test, as you can see, we are hopping on each week.
But what if, we want
start date from monday. So change, like this and as you can see, the
result is coming correctly.
You can select from
day to any day like monday, tuesday wednesday.
So actually, the
main strategy is those numbers, we have to make sure that the
addition between them should be 6.

Let change current date to
17 september.
So no matter what
your current date will be, the code will display every day of every
previous and next weeks.
The code’s link is
in the description.
Thank you for
watching, dont forget to like share and subscribe.




Friday 6 September 2019

PHP Tutorial | Display Days : Hours : Minutes : Seconds Between Two Dates


Code : 

<h1>

<center>

<?php

$current_date_time_sec=strtotime("2019-8-31 03:45:00");


$future_date_time_sec=strtotime("2019-9-3 00:00:00");


$difference=$future_date_time_sec-$current_date_time_sec;


$hours=($difference / 3600);


$minutes=($difference / 60 % 60);


$seconds=($difference % 60);


$days=($hours/24);


$hours=($hours % 24);


echo "The difference is <br/>";


if($days<0)

{

echo ceil($days). " days AND ";

}

else

{

echo floor($days). " days AND ";

}


echo    sprintf("%02d",$hours).":".sprintf("%02d",$minutes).":".sprintf("%02d",$seconds);


?>

</center>

</h1>




Hello guys.
This tutorial will be about how to get difference between two dates in days,hours,minutes,seconds format.
Lets start code with a scratch.
You have to call a function str_to_time, make sure to provide date-time format same as in the video.
This function gives the number of seconds of each date.
Now we have to calculate the diffrence.
There are formulas for calculating days, minutes, using seconds.
Make sure you type them as it is.
Now the problem is, single digit doesn’t look good, so we have to convert it using sprintf function.
This function will have two argument, 1st for formatting, and 2nd for value.
I forgot to give zero before 2.
Lets try using different numbers.
All good.
Now 49 hours means, 2 days and 1 hour extra.
So, for that, apply other formulas.
We have to overwrite the hour variable.
You see that, the days are in decimal.
So to make it easy to understand, if days are -ve, then use ceil, and if days are +ve, then use floor.
Lets, test it using different dates.
The code is in the description.
Thank you for watching, dont forget to like share and subscribe.

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)


Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/