PHP - Accurate Unix timestamp periods without MySql
Posted
by
Wonka
on Stack Overflow
See other posts from Stack Overflow
or by Wonka
Published on 2012-09-07T21:35:28Z
Indexed on
2012/09/07
21:38 UTC
Read the original article
Hit count: 246
I'm trying to have an accurate Unix timestamp values for:
today, this week, this month, this year
There are a few snags however:
- Today should be everything since last midnight
- This week should start on the last/this monday
- This month (should know if its 30/31 days or 28/29 days feb)
- This should be the very beginning of the current year up til now
I want to do this without mysql at all, purely in php as I need it as an accurate Unix timestamp to assign to a variable. Any Idea how these timestamps periods can be calculated?
© Stack Overflow or respective owner