I would like to find the date stamp of monday, tuesday, wednesday, etc. If that day hasn\'t come this week yet, I would like the date to be this week, else, next week. Thank
if you want to find Monday then 'dayOfWeek' is 1 if it is Tuesday it will be 2 and so on.
var date=new Date();
getNextDayOfWeek(date, 2);
// this is for finding next tuesday
function getNextDayOfWeek(date, dayOfWeek) {
// Code to check that date and dayOfWeek are valid left as an exercise ;)
var resultDate = new Date(date.getTime());
resultDate.setDate(date.getDate() + (7 + dayOfWeek - date.getDay()) % 7);
return resultDate;
}
Hope this will be helpfull to you, thank you
PHP 7.1:
$next_date = new DateTime('next Thursday');
$stamp = $next_date->getTimestamp();
PHP manual getTimestamp()
If I understand you correctly, you want the dates of the next 7 days?
You could do the following:
for ($i = 0; $i < 7; $i++)
echo date('d/m/y', time() + 86400 * $i);
Check the documentation for the date function for the format you want it in.
You can use Carbon library.
Example: Next week friday
Carbon::parse("friday next week");