Background
Break News
How to add local font to Tailwind Css and NextJS? - Tutorial Design Pattern? - Blockchain Technology, How to create own Bitcoin virtual currency - Zustand mordern management state - Design Pattern - Flyweight Pattern? - Docker Full training Topic

[PHP] PHP working with date - strtotime

Monday, 28 February 2022
|
Read: Completed in minutes

[PHP] PHP working with date - strtotime

Good Morning everyone, Welcome back to Learn Tech Tips Blog, continue the blog Javascript working with date and times from client side. Today we will check PHP working with date and time too from server side.

 

PHP working with date - strtotime

 

If you know this technical, so you don't be worry about it any more on any project from Server side, client side, because you had got knowledge for working with them


Tiktok 







Ok Let's begin for check how to working with date and time with PHP. I will share you example, so you shall easy understand it

date('Y-m-d h:i:s', strtotime('-30 minutes')): // get current time minus 30 minutes

date('Y-m-d'); // get current date

$day_temp = date('Y-m-d', strtotime(date('Y-m-d') . "+1 years")); // current year: 24/02/2022 => result: 24/02/2023: get next year


$day_temp = date('Y-m-d', strtotime(date('Y-m-d') . "+1 months")); // get current date add more 1 months


$day_temp = date('Y-m-d', strtotime(date('Y-m-d') . "+15 days")); // get current date add more 15 days
       

$extended_day = (strtotime(date('Y-m-d')) - strtotime($od_date)) / (60 * 60 * 24);    // get number of day between with current date with od_date

$next_year   = date('Y', strtotime($loan_date . "+" . "1 months")); // get loan_date variable of Year after plus 1 months

$next_month = date('m', strtotime($loan_date)) ; // get loan_date variable of month


$repayment_dates  = date('Y-m-d', strtotime($new_year . '/' . $new_month . '/' . $new_day)); // convert 3 variable new_year, new_month, new_day to date time
                    

$settings['duration'] = strtotime($settings['duration']) - time(); // get duration between setting['duration] params with current time
 

pr (date('j/n/y', strtotime('+4 months')));           

// add more 4 months from current date

// current date is: 24/02/2022   // => result: 24/6/22
        

pr (date('Y-m-d', strtotime('+4 months +2 weeks ')));

// add more 4 months 2 weeks from current date

// current date is: 24/02/2022      // => result: 2022-07-08

pr (date('Y-m-d', strtotime('+4 months +2 weeks +3 days')));

// add more +4 months +2 weeks +3 days from current date
    
// current date is: 24/02/2022      // => result:  2022-07-11

If you have any feedback or questions about PHP working with date and time using strtotime, leave your comment on below topic, we can discuss about it!

#php

#phplearntechtips

#phpzidane

Zidane


πŸ™‡πŸΌπŸ™‡πŸΌ We Appreciate Your Comments and Suggestions - Webzone, all things Tech Tips web development
Popular Webzone Tech Tips topic maybe you will be like it - by Webzone Tech Tips - Zidane
As a student, I found Blogspot very useful when I joined in 2014. I have been a developer for years . To give back and share what I learned, I started Webzone, a blog with tech tips. You can also search for tech tips zidane on Google and find my helpful posts. Love you all,

I am glad you visited my blog. I hope you find it useful for learning tech tips and webzone tricks. If you have any technical issues, feel free to browse my posts and see if they can help you solve them. You can also leave a comment or contact me if you need more assistance. Here is my blog address: https://learn-tech-tips.blogspot.com.

My blog where I share my passion for web development, webzone design, and tech tips. You will find tutorials on how to build websites from scratch, using hot trends frameworks like nestjs, nextjs, cakephp, devops, docker, and more. You will also learn how to fix common bugs on development, like a mini stackoverflow. Plus, you will discover how to easily learn programming languages such as PHP (CAKEPHP, LARAVEL), C#, C++, Web(HTML, CSS, javascript), and other useful things like Office (Excel, Photoshop). I hope you enjoy my blog and find it helpful for your projects. :)

Thanks and Best Regards!
Follow me on Tiktok @learntechtips and send me a direct message. I will be happy to chat with you.
Webzone - Zidane (huuvi168@gmail.com)
I'm developer, I like code, I like to learn new technology and want to be friend with people for learn each other
I'm a developer who loves coding, learning new technologies, and making friends with people who share the same passion. I have been a full stack developer since 2015, with more than years of experience in web development.
Copyright @2022(November) Version 1.0.0 - By Webzone, all things Tech Tips for Web Development Zidane
https://learn-tech-tips.blogspot.com