I have a method on my code that stores the birthday of users on a Sharepoint profile property (BirthDay).
This property only accepts the format "yyyyMMddHHmmss.0Z" so i have the following code:
_profile[PropertyConstants.Birthday].Value = birthday.ToString("yyyyMMddHHmmss.0Z", CultureInfo.InvariantCulture);
The problem is, when it converts the date, it always gives me a day less than the actual dateTime i'm using.
Let's say i have the following:
DateTime bDay = new DateTime(1972, 10, 02);
DBField = bDay.ToString("yyyyMMddHHmmss.0Z", CultureInfo.InvariantCulture);
When i check on the profile of the user, the date in there is 10/01/1972 instead of 10/02/1972.
I'm in Brazil so i don't know if it's a CultureInfo thing (already tried our CultureInfo("pt-BR") and still gives me a day less) or what.
Any ideas how can i make it not take that 1 day off?
Thanks in advance.
DateTime bDay = new DateTime(1972, 10, 02);tryDateTime bDay = new DateTime(1972, 10, 02, 12, 0, 0);. I find this is a better way to record timestamps for all-day events that don't involve start-stop times, that way the date itself is accurate anywhere in the world. Since Brazil has multiple timezones, you wouldn't want to make the timezone set to one particular region. Should you prefer to adjust the timezone instead, I believe you'd change0Zto-5Z, adjust for your UTC preference. – Drew Lanclos Nov 01 '12 at 13:48