August 15, 2011 at 4:08 am
this is problem is new to me. I have to make my script globally generic.
I have to find the time left for completion of some task. i am finding the time left for task completion by datediff funtion from starttime and endtime. now suppouse the office timming are from 8 O clock to 16, So this will be 8 hours working time and suppose the task complition time aloted was 10 hours. Now the next day when i start my work i should get a message that 2 hours left for task completion.
Now the issue i am facing:
suppose I am in new zealand and my application developement is 24 X 7, so if some one is using the application in United States will get extra time because of time Difference of New Zealand and Americas.
I want it to make global. so that same time should be shown to all across world.
Is there a way to my script global.
August 15, 2011 at 4:13 am
GETUTCDATE()
Is your friend. Then you can use localisation if required...
August 15, 2011 at 4:52 am
THANKS, BUT HOW TO USE IT . i DONT KOW HOW TO USE IT AND LOCALISE IT.
August 15, 2011 at 5:15 am
scottichrosaviakosmos (8/15/2011)
THANKS, BUT HOW TO USE IT . i DONT KOW HOW TO USE IT AND LOCALISE IT.
Please don't type in capitals - some people interpret that as shouting.
Actually, the function in question is called GETUTCDATE, but for SQL Server 2008, you should use SYSUTCDATE. I found this link - you could have done the same yourself using a search engine and a computer with an internet connection.
http://msdn.microsoft.com/en-us/library/bb630387(v=SQL.100).aspx
John
August 15, 2011 at 5:16 am
scottichrosaviakosmos (8/15/2011)
...I want it to make global. so that same time should be shown to all across world.
...
GETUTCDATE() is a function which returns date and time as UTC time (Coordinated Universal Time). So, it will be the same arround the world.
scottichrosaviakosmos (8/15/2011)
THANKS, BUT HOW TO USE IT . i DONT KOW HOW TO USE IT AND LOCALISE IT.
The common practice would be to save UTC datetime in database and localise it in the client application based on the client locale.
If you need to localise time in SQL Server, then your query should know from which TimeZone it's called. SQL Server itself will have no idea what time difference should be applied until told. For example if your server is located in UK, but the client is in New Zeland, you will need to pass this fact to the query somehow.
But again, it is better practice to localise date/time in a client application not in SQLServer.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply