Knowledge sharing: Date conversion according to TimeZone

  • Gift Peddie (4/9/2009)


    I cannot attest, but I'm quiet sure that every programming language has any method to get the current time-zone.

    Timezone is based on politics so there was none in SQL Server before 2008 and in .NET it is new to .NET 3.5, I cannot say for other langauges but this application runs in 2005 so a CLR package is a very simple solution.

    Sorry, I misunderstood you. I thought the current time-zone will be provided from client side not from server. If the client is a web application the time-zone can come from anywhere in the world and the time-zone would be provided by Java-Script, ASP.NET, PHP, Perl, ...

    Greets

    Flo

  • Sorry, I misunderstood you. I thought the current time-zone will be provided from client side not from server. If the client is a web application the time-zone can come from anywhere in the world and the time-zone would be provided by Java-Script, ASP.NET, PHP, Perl, ...

    Yes you do because there are some Timezone code in JavaScript but I will not run it, so in Asp.net it is generally a server side operation which was not defined and implemented before .NET 3.5 and SQL Server 2008. I cannot tell you about PHP or Perl but in Asp.net it is a server side operation. And it is not simple because definition is based on the politicians who create laws that manages changes.

    Kind regards,
    Gift Peddie

  • Gift Peddie (4/9/2009)


    Sorry, I misunderstood you. I thought the current time-zone will be provided from client side not from server. If the client is a web application the time-zone can come from anywhere in the world and the time-zone would be provided by Java-Script, ASP.NET, PHP, Perl, ...

    Yes you do because there are some Timezone code in JavaScript but I will not run it, so in Asp.net it is generally a server side operation which was not defined and implemented before .NET 3.5 and SQL Server 2008. I cannot tell you about PHP or Perl but in Asp.net it is a server side operation. And it is not simple because definition is based on the politicians who create laws that manages changes.

    Blame on me... I thought the user agent can be used to get this information. As first it does not contain any time-zone information as second it contains the location information but they are not correct. If I look on my configuration it shows en-US because my complete windows is configured as an US system. So I think in most cases the location may be correct but a most-cases...maybe solution is not the way to go. Pearl and PHP are also server languages like ASP.NET.

    The only possibility would be to send this as session information by java-script or any other client side scripting language.

    Thanks for correction!

    Flo

  • Hi all,

    sorry for the delay in reply...

    by "multi languague" mean - I have many applications if different languagues, some are not using any .NET frame work.. but most of them are using MS SQL. And the timezone problem is common in all.

    so, instead of setting for different timezone in all applications, i thought to hv a common function in SQL itself (ultimately, data are going to be stored in SQL only).

    ... and ya, javascript cannot handle different timezone, but it can show the client's browser's timezone (according to system settings, of course). in one of my application with .net 2.0, i m getting browser's timezone by javascript and send them to remote database at server side; at there, this function will convert the date according to timezone given by the browser.

    "Don't limit your challenges, challenge your limits"

  • check this out. GMT to Local timezone conversions

    http://www.sqlservercentral.com/scripts/GMT+conversion/66492/

  • Hi Ritesh,

    Really nice script!

    But there is a confusion, though it is completely off topic: It shows that your script has been posted on 2009/05/06!!!?

    How!?

    "Don't limit your challenges, challenge your limits"

  • I wonder how did that happened, seems there is some bug with sql server central.

  • I have seen such problem in 2-3 more scripts....

    You can advice to use ur script!!! :hehe:

    "Don't limit your challenges, challenge your limits"

  • You can evaluate the script, it works very well for me.

  • I did.. and it works for me too... I think, it is general script, so will work for anybody... 😀 just kidding..

    "Don't limit your challenges, challenge your limits"

  • I also thinks it is good script that can be modified for many needs, thanks Ritesh for posting it.

    🙂

    Kind regards,
    Gift Peddie

Viewing 11 posts - 31 through 40 (of 40 total)

You must be logged in to reply to this topic. Login to reply