Jump to content

Java Help


clangstaff

Recommended Posts

I'm trying to create a sticky banner for our public website that will include the current date and current timetable week. So far I've pulled together the code below however, I'm having some issues with the date format and cannot get this to change.

Ideally the format would be 'Mon 7th November'.

 

<style>
.banner-box { 
margin: 0; 
padding:10px;
position: fixed; 
bottom: 100px; 
right: 0; 
width: 150px; 
height: auto; 
z-index: 100; 
display: none; 
text-decoration: none; 
color: #ffffff; 
background-color: #1d2129;
font-size:16px;
text-align:center;
 
}
    
</style>

<div class="banner-box" style="display: inline;">
    
<p id="date"></p>
   
<script>
document.getElementById("date").innerHTML = Date() ;

</script>

<p><b>Week 1</b><br/></p>
    
</div>

 

banner.png

Link to comment
Share on other sites

Hi @clangstaff

sorry, I've not had a chance to look at this properly.

FrogLearn uses moment.js which is a more efficient timing script for Javascript (apparently).  You can format text in different ways usign that

http://momentjs.com/

If you want to stick with Javascript, then W3C Schools has a list of date formatting http://www.w3schools.com/js/js_date_formats.asp

 

 

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...