时间显示

I'm trying to get a time of day script I had from a long time ago working again, but I also want to add some ajax scripting to it as well. I'm sure I'm missing something obvious or not completing it fully. I think I am missing more of the code but not sure were. Here is what I have:

date.js

<script type="text/javascript">
$(document).ready(function() {
      var now = new Date();
      var hours = now.getHours();
      var msg;
      if (hours < 07) msg = "Good Morning";
      else if (hours < 12) msg = "Good Afternoon";
      else if (hours < 18) msg = "Good Evening";
      $('#time p').text(msg);
    });
});
</script>

Could I add

 <?php the_date(); echo "<br />"; ?>

in the location I want to display the text and getting it working again. If not Were and what would I add the output for it to display the text at those times? Like I said I'm sure it something simple.