Hi,
I have a GridView that has a timestamp in it and server is in remote location having time other than client timings. I have implemented the time conversion method using template in gridview as shown below. The time is still being displayed as server time. Any idea I can try?
NB: Local time is 2/3/2023 01:34 AM and Server Time is showing as 2/3/2023 8:04:00 AM
Many thanks
Ahmed KhalidPosted Feb 9, 2023, 6:22 PM
Hi Naimish,
Actually, the name control issue got resolved. The main issue now is that the times returned in the TimeStamp are not returned as expected. This is how I am getting as shwon below.
1. Local time in India is: 2/7/2023 8:37 PM but the
2. TimeStamp in my gridview is showing: 2/6/2023 9:36 PM (i.e. its not returning the local time) and the
3. Server Time is showing as 2/7/2023 9:06 AM (when queried on sql server)
Naimish MakwanaPosted Feb 8, 2023, 2:46 PM
This error message indicates that the
ConvertServerTimeToLocalTimefunction is not defined in the current context. To resolve this error, make sure that the function is defined in the same page or in a code-behind file that is properly referenced in your ASP.NET page.Ahmed KhalidPosted Feb 8, 2023, 1:43 PM
Hi Naimish,
Any suggestion on below? Am still not getting local date time displayed.
Thanks
Ahmed KhalidPosted Feb 7, 2023, 2:23 PM
Hi Naimish,
I have rebuild and redeployed the pages and now its working. However the timings are not as expected. What am I missing? This is how it appears:
1. Local time in India is 2/7/2023 8:37 PM but the
2. Server Time is showing as 2/7/2023 9:06 AM. and the
3. Time Stamp in my gridview is showing as 2/6/2023 9:36 PM
NB:
1. All times mentioned above are captured at the same time and the
2. PC is configured with (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi
Thanks.
Naimish MakwanaPosted Feb 5, 2023, 2:43 PM
Hello Ahmed,
Please refer below link for error:
https://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context
Thanks
Naimish
Ahmed KhalidPosted Feb 5, 2023, 9:47 AM
Hi Naimish,
Sorry, I had some works i couldnt check it sooner. I have applied the codes as suggested in both my dev environment and production. In Dev, code is executed but with not expected time conversion. For example: It was returning Abudhabi time 1:30pm even after converting time zone to India where as at that time, India time was 3:00pm
And for production testing, it was returning compilation error as shown below. Kindly suggest
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'ConvertServerTimeToLocalTime' does not exist in the current context
Source Error:
Line 194:
Line 195:
Line 196:
Line 197:
Line 198:
Naimish MakwanaPosted Feb 4, 2023, 6:14 AM
Hello Ahmed,
Please check below code and try.
Your can also refer below link:
https://www.codeproject.com/Questions/1135581/How-to-get-system-date-time-instead-of-server
Thanks
Naimish Makwana