locked
Retrieving local time from a mobile device using asp.net 2.0 mobile pages RRS feed

  • Question

  • User930260775 posted

    I have a need to "time stamp" and activity that occurs.  The issue I'm having is the time stamp always uses the web server's local time when it writes to the SQL database.

     Since I have mobile users accessing these pages from all over the U.S., I've been trying to figure out a way to retrieve the date and time from the mobile device.

     To add a layer of complexity to this, the devices could include smart phones, hand held pc's, etc...   I've heard javascript won't run on many phone web browser's.

     Does anyone know of a way to retrieve the local time from a mobile device or some other workaround?

    On last caveat... The option to store the time as UDT and diplay based on time zone differential is not an option since there are other applications using the data not under my control that would not be able to perform this conversion.

     Thank you in advance for any suggestions.

    Thursday, March 22, 2007 1:48 PM

Answers

  • User930260775 posted

    I was able to engineer a work around.  I made a setting entry in the local database to adjust the date/time stamp based on the offset value.  This setting is used in the conversion of the reported datetime to the local datetime using the DateAdd() function.  This allows for different companies to have different databases and time zones on the same server.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 28, 2007 9:43 AM

All replies

  • User930260775 posted

    I was able to engineer a work around.  I made a setting entry in the local database to adjust the date/time stamp based on the offset value.  This setting is used in the conversion of the reported datetime to the local datetime using the DateAdd() function.  This allows for different companies to have different databases and time zones on the same server.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 28, 2007 9:43 AM
  • User907266268 posted

    I would lean towards storing time stamps in UTC and then convert it to the user's time zone.  That way it becomes a display issue that can be handled through:

    1. Client side time return where you can calculate the offset; downside here is that you might not be able to rely on client-side script being supported by the target devices.
    2. IP geolocation to determine the location of the client; downside here is that the IP could come from a pool that is not in the same time zone.
    3. Prompt the user for time zone as part of their profile settings. 

    Cheers,
    Colin

    Saturday, March 31, 2007 4:04 PM