0

With PHP date functions, we can easily use a week number which change 0 to 53. This count starts from zero each year.

I'm looking for a date format which give me a numeric value which is continuing each year without count reset.

Example:

this_week = 578 (this week is in 2015)
newt_week must be = 579 (even it's in next year)

Is there any pre-defined format for that purpose? If not, which approach can help me to find a custom solution?

Tunaki
  • 132,869
  • 46
  • 340
  • 423

1 Answers1

1

I would suggest using the PHP time function to convert to UNIX time (seconds since 1970-01-01). You can find the number of weeks since a given date by dividing by number of seconds in a week. In fact, the PHP documentation documentation (http://php.net/manual/en/function.time.php) shows an example very much like what you are trying to achieve.

Svea
  • 267
  • 1
  • 8
  • `You can find the number of weeks since a given date by dividing by number of seconds in a week`. What is with daylight saving time, leap years, leap seconds? – hek2mgl Dec 31 '15 at 12:20