2 replies [Last post]
Alan
Offline
Enthusiast
Last seen: 11 years 2 weeks ago
Joined: 2003-10-20
Posts: 72
Points: 0

Hi,

I'm trying to write an extremely simple Javascript. I basically want it to work out the current year (so, 2005) and then display that variable on the screen, as text. Does anyone know how to do that?

Tags:
Guy
Guy's picture
Offline
Enthusiast
Cambridge, UK
Last seen: 3 years 18 weeks ago
Cambridge, UK
Timezone: GMT+1
Joined: 2004-04-26
Posts: 54
Points: 0

Javascript to display current year?

<script type="text/javascript">
var theDate=new Date()
document.write(theDate.getFullYear())
</script>

Who discovered we could get milk from cows, and what did he THINK he was doing at
the time? - Billy Connolly

Alan
Offline
Enthusiast
Last seen: 11 years 2 weeks ago
Joined: 2003-10-20
Posts: 72
Points: 0

Javascript to display current year?

Hey, thanks a lot GUy. That works well Smile Thanks again.