I have a system running in PHP and am using CodeIgniter (if there is a CI specific answer to this I would be happy as well).
I often need to figure out the timestamp of dates such as "this Thursday" or "this Monday". I currently use strtotime("this Thursday")
and it gives me what I ask for.
I have a server in EST. It is 01:00 (1:00am), early morning Friday, Feb 24, 2012 in New York.
I have a user who has specified his timezone to be Pacific time. Right now it is 22:00 (10pm) late evening Thursday Feb 23, 2012 in San Francisco.
I use strtotime("this Thursday")
. Since my server is in EST, it returns me the timestamp for March 1, 2012. I would like to take the user's timezone into consideration. For my user, "this Thursday" should return Feb 23, 2012.
Can I use strtotime("this Thursday")
for it, and if so, how would I specify the target timezone?
If not, what approach would you suggest to getting the date for "this Thursday" in a specific timezone.