Hi,

I want to get Indian Standard Time (IST) in Sql Server 2005. How can I achieve this?

Note:

SELECT 'SYSDATETIMEOFFSET', SYSDATETIMEOFFSET() this query works fine in Sql server 2008. Is there any option in Sql Server 2005?

Thanks in Advance

Sort of.

There are several datetime system functions common to prior releases of SQL Server. GetDate() gives local date/time. GetUTCDate() gives GMT. You can then use datediff to find the hour difference between them to give you the offset, like so:

select datediff(hh,  getutcdate(), getdate())

So for me here in California, the offset is -8. For you in India, I would guess it's more like +5 or so.

MS simply added a new system datetime function to give you all the parts in one easy-to-use function, SYSDATETIMEOFFSET().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.