Jump to content

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.     

Edited by jazzman1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.