Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Appointment calendar problems

Community Expert ,
Oct 19, 2012 Oct 19, 2012

Copy link to clipboard

Copied

I've built a CRM for an international company. We have users in every timezone. There's a field for next appointment day and time. Each user in each part of the world will see these appointment times as GMT now. What I'd like to do is detect the users time zone and run a conversion so that when a user says Nov 10, 2012 at 10AM the time is automatically converted to GMT then stored in the appointment field. I've found several slick Java appointment date and time widgets that will crate a pop up calendar and time to populate the field with data in the standard mySql date format, but I haven't been able how to use PHP date functions to read the local machine timezone, convert the data entered into the field, then calculate the diference and update the hours value to GMT.

If anyone has any ideas I'd appreciate it. Once the value is GMT I have no problem converting it back to local time for display in the CRM. 

If you have any better ideas let me know.

Thanks.

TOPICS
Server side applications

Views

585
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 21, 2012 Oct 21, 2012

Copy link to clipboard

Copied

I don't know how to read the machine timezone but doubt that you really want to do that anyway because it is extremely likely to be wrong. You can easily determine the time zone of the ip address that is being used, but again, this may also not be the correct timezone for the task.  And what happens when the employee is in China but scheduling a meeting for Australia?

So, if I understand your issue, the way I think I would handle it is to let the user select both a default timezone as well as apply a timezone to particular appointment entries, or to particular days. This solution may not seem as slick, but I suspect that juggling the timezones behind-the-scene might be a huge headache.

I would also use the PHP dateTime and DateTimeZone classes instead of the PHP date functions.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 21, 2012 Oct 21, 2012

Copy link to clipboard

Copied

LATEST

Can you let the user store their preferred timezone with their profile? That's how most CMS's would handle it.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines