How to get the exact time of the user's country when he commment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dinesh1985singh
    New Member
    • Apr 2010
    • 49

    How to get the exact time of the user's country when he commment

    I want to get the exact time of user when he did comment. As the user belongs to different country so I want to get the exact time of his country just like in discussion form in PHP.
    Last edited by Niheel; May 16 '10, 08:07 AM. Reason: punctuation, grammar, only necessary details for question
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    The time function gives you the current time as a Unix timestamp, which you can format into readable dates using the date function. - It is generally best to store dates as timestamps, or at least using the GMT timezone, so you can more easily manipulate what timezone is to be used to display it.

    Getting the client's timezone is trickier, though. If your users register for the site, then you would be best off asking them to choose the timezone they want used during the registration process. If not, you will have to resort to something like geo-location via the IP address.

    Comment

    • dinesh1985singh
      New Member
      • Apr 2010
      • 49

      #3
      Originally posted by Atli
      Hey.

      The time function gives you the current time as a Unix timestamp, which you can format into readable dates using the date function. - It is generally best to store dates as timestamps, or at least using the GMT timezone, so you can more easily manipulate what timezone is to be used to display it.

      Getting the client's timezone is trickier, though. If your users register for the site, then you would be best off asking them to choose the timezone they want used during the registration process. If not, you will have to resort to something like geo-location via the IP address.
      Thank you Atli,

      I am exactly interested in getting geo-location or time zone via users ip.So please let me know this.

      thanks for your any kind of suggestion
      Thank you

      Comment

      • phobia
        New Member
        • May 2010
        • 5

        #4
        There are multiple providers for that kind of data, e.g. ip2location.com and maxmind.com.

        Since you only need to know the country, the free GeoLite Country db from Maxmind should do. Have a look here: http://www.maxmind.com/app/geolitecountry

        Comment

        Working...