Jump to content

Cenvert user time to server Time


sheraz4pro

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/287637-cenvert-user-time-to-server-time/
Share on other sites

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

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.     

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.