Click to See Complete Forum and Search --> : Numbered day of the ear script


Stan
08-11-2003, 01:12 AM
Looking for a script that will display the numbered day of the year it is. Some folks call it the Julian Calendar. Example today the 11th of August is the 223rd day of the year.

Thanks

Stan

Charles
08-11-2003, 05:27 AM
<script type="text/javascript">
<!--
Date.ONE_SECOND = 1000;
Date.ONE_MINUTE = Date.ONE_SECOND * 60;
Date.ONE_HOUR = Date.ONE_MINUTE * 60;
Date.ONE_DAY = Date.ONE_HOUR * 24;

Date.prototype.getYearDay = function () {return Math.floor((this.getTime() - new Date(this.getFullYear(), 0, 1).getTime()) / Date.ONE_DAY) + 1};

alert(new Date().getYearDay());
// -->
</script>

Stan
08-11-2003, 07:27 PM
Thanks that did the trick, expecially when you understood that I needed a year function and not an ear function.

Cheers,

Stan