Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <tittle> Random clock</tittle>
  <link href="" rel="stylesheet">
  <link href="" rel="stylesheet">

  <h2 id="funny-intro" class ="intro"> It's time to</h2>

<div id="clock">clock goes here</div>

  <div class="container">
  <img id="funny-pic" src="" alt="breakfast">
  <div id="time-event" class= "text-block"> It's breakfast time</div>
  <!--Set breakfast-->
<label for="setwakeup">Set wake up time:</label>
  <select id="setwakeup">
        <option value="5"> 5-6am</option>
    <option value="6"> 6-7am</option>
    <option value="7"> 7-8am</option>
    <option value="8"> 8-9am</option>
    <option value="9"> 9-10am</option>
    <option value="10"> 10-11am</option>
  <!--Set luch time-->
  <label for="setlunchtime">Set lunch time:</label>
  <select id="setlunchtime">
        <option value="10"> 10-11am</option>
    <option value="11"> 11-12pm</option>
    <option value="12"> 12-1pm</option>
    <option value="13"> 1-2pm</option>
    <option value="14"> 2-3pm</option>

  <!--set dinner time-->
  <label for="setdinner">Set dinner time:</label>
  <select id="setdinner">
        <option value="16"> 4-5pm</option>
    <option value="17"> 5-6pm</option>
    <option value="18"> 6-7pm</option>
    <option value="19"> 7-8pm</option>
    <option value="20"> 8-9pm</option>
    <option value="21"> 9-10pm</option>
  <!-- set break time-->
  <label for="setbreaktime">Set breaktime:</label>
  <select id="setbreaktime">
        <option value="11"> 11-12am</option>
    <option value="12"> 12-1pm</option>
    <option value="13"> 1-2pm</option>
    <option value="14"> 2-3pm</option>
    <option value="21"> 9-10pm</option>
    <option value="22"> 10-11pm</option>
  <button id="party"> Let's party time</button>








tittle{font-family: 'Fredoka One', cursive;
body{text-align: center;
     font-family: 'Noto Sans', sans-serif;
 #clock { color:black;
  font-size: 40px;
  display: block;
   padding: 5px 0px}
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
.text-block {font-size:2em;
  position: absolute;
  bottom: 30px;
  background-color: black;
  color: white;
  padding-left: auto;
  padding-right: auto;}
button{  background-color: #222;
         margin: 20px;



                var time = new Date().getHours();
 var wakeuptime = 7;
var noon = 12;
var partytime;
var dinnertime = 19;
var lunchtime = 12;
var breaktime = lunchtime + 2;
var evening = 18;
var partytime;

//show the clock on page
var startTime = function () {var today = new Date();
  var hours = today.getHours();
  var mins = today.getMinutes();
  var secs = today.getSeconds();
  mins = checkTime(mins);
  secs = checkTime(secs);
  var timeOfDay = (hours < 12)? "AM":"PM" ;
  hours = ( hours > 12 ) ? hours - 12 : hours;

  // get the clock string
document.getElementById('clock').innerHTML =   hours + ":" + mins + ":" + secs   + timeOfDay;

  function checkTime (i){ if (i < 10)
                        {i = "0" + i ;}
                        return i;}
// Getting the clock to increment once a second
var oneSecond = 1000;
setInterval( upDateClock, oneSecond);

// Getting the clock to change out messages and pictures
var upDateClock = function(){

 var message;
  var image = "" ;
  var timeEvent = document.getElementById('time-event');
  var imageJS = document.getElementById('funny-pic');
 //morning image and message
  if (time < noon ){message = "Good morning";
                     image = "";}
  // wakeuptime
  else if (time == wakeuptime){message = "It's breakfast time";
  //partytime image and message
  else if (time == partytime){message = "YAY";
                              image = "";}
  else if (time >= evening ){message = "Good evening";
                             image = "";}
  else if (time == lunchtime ){message = "Let's have lunch";
                               image = "";}
  // break
  else if (time == breaktime){message = "Let's have a break";
                              image = "";}
  else if (time == dinnertime){message = "let's have dinner";
                                image = "";}
  //Don't think I need this
  else {message = "Good afternoon";
                                          image = "";}
  // console it out
  timeEvent.innerText = message;
  imageJS.src = image;

// Getting the clock to increment once a second
var oneSecond = 1000;
setInterval( upDateClock, oneSecond);

// change party button
var partyButton = document.getElementById("party");
var partytime;
 var partyEvent = function()
{if (partytime < 0) 
        partytime = new Date().getHours();
                                 party.innerText = "It's over";}
                else {partytime = -1;
                     party.innerText = "Party time";}};
partyButton.addEventListener("click", partyEvent);

// active set wake up time
var setWakeUp = document.getElementById("setwakeup");
var wakeupEvent = function (){ wakeuptime = setWakeUp.value;};

setWakeUp.addEventListener("change", wakeupEvent);
// active set lunch time
var setLunchTime = document.getElementById("setlunchtime");
var lunchtimeEvent = function (){ lunchtime = setLunchTime.value;};

setLunchTime.addEventListener("change", lunchtimeEvent);
// active dinner time
var setDinnerTime = document.getElementById("setdinner");
var dinnerEvent = function(){dinnertime = setDinnerTime.value;};