XModPro

UTC datetime

Cata Cata asked Mar 29, 2020
Active Mar 29 · Viewed 1980 times
<p>Hello,<br>My server is located in a different timezone than the users are: <br>1. How I can display in template the conversion form UTC to the 'browser' timezone?<br>2. How I add or update form the 'browser' timezone to the UTC?<br>The select and update command should get at least the offset value - this could be done by moment.js but I do not know how to pass it to the command ...<br><br> </p> <p> &lt;ListDataSource CommandText="SELECT DATEADD(MINUTE, @offset,convert(datetime2, mydate)) as GMT FROM a_time"&gt; </p> <p>&lt;Parameter Name="offset" Value='[offset]' DataType="int32" /&gt; </p> <p> &lt;/ListDataSource&gt; </p> <p> &lt;SubmitCommand CommandText="UPDATE [a_time] SET [my]=DATEADD(MINUTE, @offset,convert(datetime2, mydate)) WHERE [ID]=@ID"&gt; </p> <p>&lt;Parameter Name="offset" Value='[offset]' DataType="int32" /&gt; </p> <p>&lt;/SubmitCommand&gt; </p> <p>For the SQL Server 2016 the solution would be to use AT TIME ZONE but let me know if there is a way to get the timezone of the browser in Windows format sys.time_zone_info <br>Here is a nice article about that <a href="https://sqlperformance.com/2016/07/sql-plan/at-time-zone">https://sqlperformance.com/2016/07/sql-plan/at-time-zone</a><span class="redactor-invisible-space"></span> </p>

0 Answers

Loading answers...