views:

215

answers:

2

Setup: Windows Server 2003 / SQL Server 2005. ASP.NET 2.0. IIS 6.

The site I'm working on uses ASP.NET Membership and when a user is created it is inserted into the aspnet_membership database.

All servers are set at Central Time. I also verified this by doing a Select GetDate() on SQL Server and it returned central time.

However, when a user is inserted into aspnet_membership, their CreateDate is listed in GMT. (Greenwich Mean).

I've looked at the code and there is NO DateTime.Now.AddHours(6); anywhere associated with creating members.

Does Membership just uses GMT by default? Can this be changed somewhere? Is there any advantage to using GMT? I'm not doing any Timezone specifics on the users side, so I see no need for it.

Anyway if you have any ideas on what I'm overlooking it would be greatly appreciated.

Thank you!

+1  A: 

Using UTC (not GMT) has the additional advantage that you don't have to worry about Daylight saving.

If you look at the dbo.aspnet_Membership_CreateUser stored procedure you find a @CurrentTimeUtc parameter, which suggets to me that all datetimes in the ASP.NET Membership are indeed UTC.

You can use the DateTime.ToLocalTime to convert to local (server) time.

pb
A: 

Membership does automatically use UTC as described in this article: http://aspnet.4guysfromrolla.com/articles/041608-1.aspx

David Stratton