Is there a standard function in PHP that will find the day number of the year based on the current date?
Examples:
Jan 22nd = 22 Feb 27th = 58 Mar 5th = 64
If there isn't a standard function, has anyone built anything similar that would handle the conversion? What all is involved?
You can simply use the PHP date() function to get the current data and time in various format, for example, date('d-m-y h:i:s') , date('d/m/y H:i:s') , and so on.
The date function in PHP is used to format the timestamp into a human desired format. The timestamp is the number of seconds between the current time and 1st January, 1970 00:00:00 GMT. It is also known as the UNIX timestamp.
php /*print date in dd/mm/yy format*/ print "Current date in dd/mm/yy format: " . date("d/m/y"); print "</br>"; /*print date in dd/mm/yyyy format*/ print "Current date in dd/mm/yyyy format: " . date("d/m/Y"); print "</br>"; /*print date in dd MON yyyy format*/ print "Current date in dd MON yyyy format: " .
date('z') + 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With