Results 1 to 4 of 4

Thread: Time Conversion Problem

  1. #1
    flufner is offline Junior Member
    Join Date
    May 2008
    Posts
    3

    Default Time Conversion Problem

    Hey there.
    I have a project i'm working on to display all meetings for a given sales agent on a google map. It is already finished and works great, but the implementation is lacking.
    For my new version, I want to authenticate sales agents through soap, and use sugar's abilities for time conversion etc.

    My problem is that I want to scan the meetings for a particular DATE in a local timezone.
    BUT:: The database stores all meetings in GMT.


    Now if the time offset is 5, then meetings for 7pm would already show for the next GMT date in the database. Get it?

    I would like to know how I can elegantly overcome this problem. Does soap have a method to superimpose the database date_start in meetings? That way, I could pass on the local date I want to do the look-up for and not worry about conversion.

    If that's too much to ask, is there a sugar method that will give me a datetime start and endpoint in gmt that corresponds with my local date im trying to do the lookup for? For example: 22 june 10pm through 23 june 10pm gmt corresponds with 23 june gmt-2.

    If none of that is possible, I can rewrite my old selfmade method, but It gets complicated with daylight saving time exceptions etc. This is the exact reason why I would like to use a better way and handle this.

    Finally, I also tried to scan the database to find where user timezone preferences are stored, but couldn't find it. Is there any chance someone can point out to me where to find it?

    I'm new to soap, and only started to learn sugar crm. Thanks for your tremendous help.

  2. #2
    flufner is offline Junior Member
    Join Date
    May 2008
    Posts
    3

    Default Re: Time Conversion Problem

    bumping .

  3. #3
    anna is offline Sugar Community Member
    Join Date
    Jan 2007
    Location
    USA
    Posts
    81

    Default Re: Time Conversion Problem

    To find the timezone per user, go to user_preferences table, look for category=global, assigned_user_id='the corresponding user', grab the contents, base64decode and unserialize them: you will have a 'timezone' key in the array that tells you the timezone of the user. To use Sugar functions, you can simply call $current_user->getPreference['timezone'] to handle all the lookups. How you would do that through soap though, I don't know Date formatting is explicitly turned off in soap via $disable_date_format = true, so everything will be passed and returned in GMT.

    As an alternative, you can try and convert your search dates into GMT (gmdate() ) prior to sending them as search criteria through soap - seems like that would also solve the problem of dates being stored in GMT in the DB since you will then be comparing same formats ...

  4. #4
    flufner is offline Junior Member
    Join Date
    May 2008
    Posts
    3

    Default Re: Time Conversion Problem

    your my hero :-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with Email Campaign
    By Thommy in forum Help
    Replies: 0
    Last Post: 2006-06-08, 03:30 PM
  2. Replies: 3
    Last Post: 2006-03-28, 01:13 AM
  3. Time tracking module
    By magnus in forum Feature Requests
    Replies: 12
    Last Post: 2006-03-05, 12:42 PM
  4. MYSQL Problem
    By rana in forum Help
    Replies: 0
    Last Post: 2005-11-11, 08:56 AM
  5. Firefox selection problem in SCRM350
    By mahmood in forum Help
    Replies: 5
    Last Post: 2005-08-30, 07:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •