Friday, February 14, 2014

Daylight saving time ended and Sharepoint still off by 1 hour

The daylight saving time ended, but SharePoint still saving all items which require a date time stamp reference with 1 hour less (in my case).

Screenshot of the behavior:

daylight1

1.Modify the Timezone.xml file to include the correct date and time for standard time and for daylight saving time. To do this, follow these steps:

a. Start Notepad, and then open the Timezone.xml file.

The Timezone.xml file is located in the following folder:

SharePoint Server 2013

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\Config

SharePoint Server 2010

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Config

Windows SharePoint Services 3.0 / MOSS 2007

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Config

Microsoft Windows SharePoint Services 2.0

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Config

b. The contents of the Timezone.xml file should resemble the following example bellow that I will modify.

c. Locate the time zone that you want to modify. In my case was Name=”(UTC-03:00) Brasilia”

<TimeZone ID=”8″ Name=”(UTC-03:00) Brasilia” Hidden=”FALSE”>
<Bias>180</Bias>
<StandardTime>
<Bias>0</Bias>
<Date>
<Month>2</Month>
<Day>4</Day>
<Hour>23</Hour>
<Minute>59</Minute>
<Second>59</Second>
<Milliseconds>999</Milliseconds>
<DayOfWeek>6</DayOfWeek>
</Date>
</StandardTime>
<DaylightTime>
<Bias>-60</Bias>
<Date>
<Month>10</Month>
<Day>3</Day>
<Hour>23</Hour>
<Minute>59</Minute>
<Second>59</Second>
<Milliseconds>999</Milliseconds>
<DayOfWeek>6</DayOfWeek>
</Date>
</DaylightTime>
</TimeZone>

d. Modify the StandardTime element to specify the correct date and time for standard time. For the current time zone, change the Day fields from 4 to 3.

<TimeZone ID=”8″ Name=”(UTC-03:00) Brasilia” Hidden=”FALSE”>
<Bias>180</Bias>
<StandardTime>
<Bias>0</Bias>
<Date>
<Month>2</Month>
<Day>3</Day>
<Hour>23</Hour>
<Minute>59</Minute>
<Second>59</Second>
<Milliseconds>999</Milliseconds>
<DayOfWeek>6</DayOfWeek>
</Date>
</StandardTime>
<DaylightTime>
<Bias>-60</Bias>
<Date>
<Month>10</Month>
<Day>3</Day>
<Hour>23</Hour>
<Minute>59</Minute>
<Second>59</Second>
<Milliseconds>999</Milliseconds>
<DayOfWeek>6</DayOfWeek>
</Date>
</DaylightTime>
</TimeZone>

e. Click Save on the File menu to save your changes.

f. Clean the SharePoint cache using PowerShell on SharePoint 2010 or manually for other versions. Bellow the PowerShell script:

#PowerShell Script to clean SharePoint Configuration cache:

Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

Stop-Service ProjectQueueService14

Stop-Service ProjectEventService14

Stop-Service SPTimerV4

$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
{
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
{
if ($item.Name.ToLower() -eq “cache.ini”)
{
$cachefolder = $folder.FullName
}

}
}

$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
{
if ($cachefolderitem -like “*.xml”)
{
$cachefolderitem.Delete()
}

}

$a = Get-Content  $cachefolder\cache.ini
$a  = 1
Set-Content $a -Path $cachefolder\cache.ini
start-Service SPTimerV4
IISRESET

########################

g. Test your environment again. Now, everything will be working right.

daylight2

Good references:

http://support.microsoft.com/kb/888253/en-us

http://spinternals.blogspot.com.br/2014/01/sharepoint-powershell-script-para.html

No comments:

Post a Comment