PHP how to get last 6 months first date
You can try following way - for ( $i = 1 ; $i < 7 ; $i ++) { echo date ( ', Y-m-01' , strtotime ( "- $i month" )); }
You can try following way - for ( $i = 1 ; $i < 7 ; $i ++) { echo date ( ', Y-m-01' , strtotime ( "- $i month" )); }
Here is different way to get the date of a selected day ago in PHP . The ways are as bellow - Way - 1: strtotime() will do the trick. Convert your previous date to a Unix timestamp using …
Try this: date('d-m-Y', strtotime($user->from_date)); It will convert the data into d-m-Y or whatever format you have given. For the above PHP code, you can use Laravel or any ot…
I have written a javascript function to solve this problem. Here I get the current date-time using the new Date() object. Then formate it. Get Current Date Function: function getCurrentD…
Steps : Create a new Date() object. call getFullYear() from the object. the code will as bellow - var date = new Date(); var currentYear = date.getFullYear() console.log(currentYear); O…