7

Right now, if you click an outcome in the Sitecore Experience Profile journey timeline, the outcome details shows the time in the following format: 06.10.2016 14:49:55

Is it possible to change this to MM/dd/yyyy hh:mm:ss format?

I am using Sitecore 8.1 Update 2 with xDB Cloud

2
  • Where is that timeline located? Is your question about a particular application within Sitecore, like the Experience Profile? Oct 7, 2016 at 6:00
  • From the dashboard, select Experience Profile, select a contact, timeline appears on the top of the page (there is a toggle button for it). Click on a visit in the timeline and a visit detail panel slides into view. This is where I see the Euro-formatted dates. Oct 7, 2016 at 6:06

2 Answers 2

2

Short answer, looks like the date formats are hard-coded in Sitecore.Cintel.Client.dll. Looks like you need to write a custom Transformer that uses its own TimeConverter for the views you would like to modify in the Experience Explorer. Here is a post I wrote on how to do just that.

P.S: Just scroll to the bottom to get to the good stuff.

2

Experience Profile has a concept of client transformers that modify data before it's displayed. Each page can have its own transformer. The configuration for it is in Sitecore.ExperienceProfile.Client.config. Specifically in your case you would need to replace the transformer for journey-detail-outcome view.

1) Define a time converter and provide your custom date/time formatting.

class MyTimeConverter : TimeConverter
{
    public MyTimeConverter(Sitecore.Cintel.Client.Repository repository, Sitecore.Cintel.Client.ContextUtil contextUtil)
        : base(repository, contextUtil)
    {
    }

    public override string FormatDateTime(DateTime time)
    {
        return base.FormatDateTime(time, "dd/MM/yyyy HH:mm:ss"); //can be read from config
    }
}

2) Define a ResultSetExtender that is used to apply transformations to the data returned by the Experience Profile. Custom time converter is one of the constructor parameters.

public class MyResultSetExtender : ResultSetExtender
{
    public MyResultSetExtender() : this(
        Sitecore.Cintel.Client.ClientFactory.Instance.GetResultSetHelper(),
        new MyTimeConverter(Sitecore.Cintel.Client.ClientFactory.Instance.GetRepository(), Sitecore.Cintel.Client.ClientFactory.Instance.GetContextUtil()),
        Sitecore.Cintel.Client.ClientFactory.Instance.GetTextConverter())
    {         
    }

    public MyResultSetExtender(
      Sitecore.Cintel.Client.Transformers.ResultSetHelper resultSetHelper, Sitecore.Cintel.Client.Transformers.TimeConverter timeConverter,
      Sitecore.Cintel.Client.Transformers.TextConverter textConverter)
      : base(resultSetHelper, timeConverter, textConverter)
    {
    }
}

3) Define an actual transformer for the view and supply the result set extender from the previous step.

public class MyOutcomeTransformer : Sitecore.Cintel.Client.Transformers.Contact.JourneyOutcomeDetailResultTransformer
{
    public MyOutcomeTransformer() : base(new MyResultSetExtender()) { }
}

4) Patch Sitecore.ExperienceProfile.Client.config.

Your Answer

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

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