Today February 5, 2012 is ...
Day 36
Day of year is a number between 1 and 366 (January 1 is day 1).
Some application use 'ISO day of year' numbers, this is a number between 1 and 371, day 1 of the year is Monday of the first ISO week (where the first Thursday of the new year is in week 1).
Programming routines
PHP
$dayNumber = date("z") + 1;
You can use an epoch to find other day numbers:
date("z", epoch) + 1
date("z") starts counting from 0 (0 through 365)!
Python
day_of_year = datetime.now().timetuple().tm_yday
PERL
my $dayNumber = POSIX::strftime("%j", gmtime time); Replace time with other epochs for other days.
MySQL
SELECT DAYOFYEAR(NOW())Day number between 1 and 366. Replace now() with other dates eg.:
SELECT DAYOFYEAR('2008-02-20');
Microsoft Access
DatePart("y",Date)
JavaScript
Add a 'Day of Year' method to the date object:'Day of Year Date Method' on About.com
Unix/Linux
date +%j
ColdFusion
#dayofyear(now())#
Also see: Current week number
Comments and questions
blog comments powered by DisqusPages
HomeTools
Epoch converter
Batch converter
Epoch clock
Epoch list
Time zone converter
Programming
Routines by language
Epoch in PERL
Epoch in C
Epoch in MySQL
Epoch in VBScript/ASP/JavaScript/PHP
Date and Time
Calculate difference between two dates
Week numbers
Weeks by year
Day numbers
More
Comments & questions
Epoch Converter for Mobiles
Este sitio en Español
Related cookbooks
Unicode Tools
Character Set Tools