PDA

View Full Version : Automatically generate year?


helpplease
02-02-2003, 11:53 PM
Hi!
I need a basic script that will automatically generate the year next to my copyright, so I don't need to update it every year.

I have:

<script>
document.write(Date()+".")
</script>

but I just want to have the year, not the whole date.

Thanks for any help!
:p

Algorithm
02-03-2003, 12:11 AM
(new Date()).getFullYear()

helpplease
02-03-2003, 12:14 AM
Thank you!!!

ca_redwards
02-10-2003, 11:14 AM
Originally posted by Algorithm
(new Date()).getFullYear()

I use this expression in generating the status line copyright message for my HTML() bookmarklet library (http://www.angelfire.com/ca/redwards/html__.calendar.html). Perhaps you might want to use the last modification date as the "start date" of your copyright...

'Copyright '+(then=new Date(document.lastModified).getFullYear())+((then<(now=new Date().getFullYear()))?'-'+now:'')

:thumbsup: