After migrating content from Sitecore 6.5 I see dates staying not in canonical 8+ Sitecore format.

Some samples (raw values) from my current project:

  • 20140329T120917 - no Z at the end
  • 20140329T123823:635316935030258782 - no need for so many digits

All dates created in Sitecore 8 (I checked Created and Updated fields) follow the same yyyyMMddTHHmmssZ pattern.

What is the best way to change dates format when content is moved from old Sitecore version to a new one?

  • If I were at a computer I would totally show you a solution in SPE. Unfortunately I'm sitting in a parking lot. I can however tell you that we use SPE to serialize SPE items while removing the Z. Will try to point you to the script that makes the magic happen. Oct 13, 2016 at 1:11
  • 3
    We have a function here to fix legacy dates.github.com/SitecorePowerShell/Console/blob/master/… Oct 13, 2016 at 1:13

2 Answers 2


Here is a prototype for you to test with in your non-production instance.

Sitecore PowerShell Extensions

$items = @(Get-Item -Path "master:\content\home") + @(Get-ChildItem -Path "master:\content\home")
$expression = "\d{8}[T]\d{6}"
foreach($item in $items) {
    $item.BeginEdit() | Out-Null
    if($item.Fields["__Created"].HasValue -and ($item.Fields["__Created"].Value -match $expression)) {
        $item.Fields["__Created"].Value = $matches[0]

    if($item.Fields["__Updated"].HasValue -and ($item.Fields["__Updated"].Value -match $expression)) {
        $item.Fields["__Updated"].Value = $matches[0]
    $item.EndEdit() | Out-Null

The code finds the home item and the immediate children, then looks for dates that have values and matches the pattern you specified. I'm accessing the value directly on the field since it gives the raw value (rather than a datetime).


PSE sounds like a goer, though if you're not comfortable with PowerShell and as it's a migration project which you're going to re-run then you could do something with the rules engine.

On the 8.x instance when the content item from 6.x saves, have a rule which examine the date fields and change as appropriate.

Can only find an old cookbook (https://sdn.sitecore.net/upload/sitecore6/61/rules_engine_cookbook_sc61_a4.pdf) on the rules engine as I'm on a train with a dodgy web connection

  • Note that at least the current version of Sitecore 8 will automatically update date fields from the old format to the new. Jan 16, 2018 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.