Reformatting an Ordinal Date PHP

An ordinal date is a way of formatting a calendar date that omits the month. Whereas you might sometimes find a date formatted YYYY-MM-DD, an ordinal date is formatted YYYY-DDD, with a date between 1 and 365 (366 on leap years). For instance, February 5th, 1999 in ordinal date format would be 1999-036. If you are displaying the date on your webpage, you can reformat it to use ordinal date format. You just need to know the PHP codes.

Instructions

    • 1

      Open the PHP code containing the date as a text file.

    • 2

      Find the section that begins “strftime” (this is the code controlling the date).

    • 3

      Replace whatever is in the following parentheses with “%y”-“%j”. It will look like: strftime(“%y”-“%j”). This “%j” lists the date in day-of-the-year format, unlike the standard %d, which does day-of-the-month.

Related Searches:

References

Comments

Related Ads

Featured