Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript or PHP Date List

Featured Replies

Hey,

 

I'm creating a website for a website that will allow people to book accomodation.

 

I need to generate a SELECT list which contains a list of saturdays (with the dd/mm/yyyy) for the next two years. I'm able to use either JavaScript or PHP to generate this list. I've had several attempts of coding something myself, but am not getting very far at all.

 

Anyone got any suggestions on how I can do this? Or a link to a script that will do this?

 

Thanks in advance!

You could use something along the lines of this in php:

<?php
$start = mktime(0, 0, 0, date("m"),   date("d"),   date("Y"));
$end = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+2);
echo '<select name="saturdays">';
while ($start <= $end) {
if (date('l', $start) == 'Saturday') {
$day = date('l d/m/Y', $start);
$value = date('d/m/Y', $start);
echo "<option value=\"$value\">$day</option>\n";
}
$start += 86400;
}
echo "</select>";
?>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.