I have a DateTime field (Date Only) that uses the "Today's Date" as a default value. However, when a user adds an item to the list the date that is selected is respective to the GMT timezone.
Therfore if a user adds an item on 2/22/2012 at 7pm (EST) the default value will actually read 2/23/2012.
My first thought was to check the web application settings, and they were set to -5 EST. Then after some searching I found that time zones can differ based on a users regional settings. Testing this approach, I manually set a user to have a EST time zone, and performed the test that yielded the same result.
Finally, after more searching I found one article that said to use the Calculated Value portion of the DateTime field and specify "=NOW()"
This however returned "The formula contains a syntax error or is not supported."
Does anyone know of a way to have the default value of a DateTime field respect the time zone of the web application or the user?
Thank you.
Sharepoint stores all date field in UTC. That is, if you are saving a datetime field in a list, Sharepoint actually converts the time that you selected into UTC, and converts it back to whatever time zone the person is in when retrieving.
Begin by checking if there's a difference between your server timezone and your client. When using any API SharePoint will always return the UTC time and leave it up to you to make the conversion in your interface or application.
If you like to solve this differently you can't use the datetime datatype, instead store dates in text fields.
== UPDATE ==
If you got a date from SharePoint (always in UTC) and simply want to convert it to your local time this is a good practice
If you got the date as a string, or are uncertain of the formatting and whatnot this can be a good approach