sheraz4pro Posted April 9, 2014 Share Posted April 9, 2014 I am new to PHP. i am working on an application in which logged in user will set datatime on which they want to be notified about some event. On that time, server will send email to the user. The problem is i have to send emails relative to user's specified datetime. i have got following information of user timezone. GMT , OFFSET. Now i don't know how to calculate/convert user date/time to server datetime. Please guide or give me some example code. i ahve serached the net but unable to understand it because they are using timezone somthing like it $userTimezone = new DateTimeZone('America/New_York'); but i don't have timezone in this format. i only have offset and GMT or UTC thing. please guide me how i will convert it to server time. Quote Link to comment https://forums.phpfreaks.com/topic/287637-cenvert-user-time-to-server-time/ Share on other sites More sharing options...
X5HOST Posted April 9, 2014 Share Posted April 9, 2014 Hi Sheraz4Pro, I would seriously consider timezones before you start using them, have a check of the PHP manual and try to understand the difference between timezones, but they can seriously be a very complicated thing to work with, especialy when it comes to what you're trying to do, on the other hand, there might be a simple way of constructing what you're trying to do, it's not impossible, but it's complicated. There might be an open-source PHP timezone kit out there which may come in useful. Kind Regards, Jason Moore Quote Link to comment https://forums.phpfreaks.com/topic/287637-cenvert-user-time-to-server-time/#findComment-1475575 Share on other sites More sharing options...
sheraz4pro Posted April 10, 2014 Author Share Posted April 10, 2014 is there anyone who can guide me? Quote Link to comment https://forums.phpfreaks.com/topic/287637-cenvert-user-time-to-server-time/#findComment-1475681 Share on other sites More sharing options...
jazzman1 Posted April 11, 2014 Share Posted April 11, 2014 (edited) Why don't you use the php date/time function to convert the server and client time format to UnixTime Stamp (Integer Format), then do some calculation with those integers and return the result back to your clients to human readable date/time format. Edited April 11, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/287637-cenvert-user-time-to-server-time/#findComment-1475787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.