Convert to users' local time RRS feed

  • Question

  • User-670224152 posted

    Dear all,

                        i am having database which store soccer world cup 2010 match schedule and it consist few field as Match no, date, time, venue team1,team2  and match date and time stored as host's local time this details showed in gridview in my page ,upto here everthing works well.

                Now i want to add new feature to convert the match time to users'  local time. I have tried few way to update the database but, not succeed and hope i get help here thanks.

    Wednesday, January 27, 2010 11:13 AM


  • User1960438654 posted

    You can store the proper TimeZone for each your client (initialize it during SessionStart or Login for example) and then use it for provide the proper Time within all your data-based controls.

    I've found the following code snippet for getting the TimeZone offset for the client from JavaScript:

    <script language="javascript">
    ourDate = new Date();
    document.write("The time and date at your computer's location is: "
    + ourDate.toLocaleString() 
    + ".<br/>");
    document.write("The time zone offset between local time and GMT is " 
    + ourDate.getTimezoneOffset() 
    + " minutes.<br/>");
    document.write("The time and date (GMT) is: " 
    + ourDate.toGMTString() 
    + ".<br/>");

     At this link you can find the comprehensive description: http://www.htmlgoodies.com/beyond/javascript/article.php/3472371


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 27, 2010 11:34 AM