1 Reply Latest reply on Oct 15, 2015 7:29 PM by vlad_green

    Search&Promote: how do I change the format of dates in results?

    alexander_santoro

      In Search&Promote I am creating a Date field with "Monday, 24. May 2013 06:30 PST", and I would like to have it displayed as May/24/2013". How can I do that?

       

      Thanks.

      • 0. Re: Search&Promote: how do I change the format of dates in results?
        vlad_green

        This topic requires some explanation:

        1. Getting the date into the index
        1. The field must the “date” type.
        2. Once you get the Date data in the field you can do whatever you want with it: change format, change time zone (consistently), etc.
        3. For this you need to create a specific mask in the field what will receive the data/time data. You can have multiple masks for the date/time you are getting.
        4. If you do not have a right mask to ingest the data into the field the crawler will complain and will report it as an error in the index log.
        5. By default all dates and times are stored in the index using the time zone set for the index. (Settings > Accounts Options > Account Settings > Time Zone)
        • if your index is Germany time zone, and the time saved is “11:01:00 PM”, it will be saved as 11:01:00 PM Germany time. This unless you specify a different time zone in the field definition (at the bottom).
        • [img]date_field.png[/img]
        1. Getting the date out of the index
        1. If the data for date/time was saved successfully in the index now you just need to recover it in the transport layer, where you can format it.
        2. This is how you call the date field in the transport layer: <search-display-field name="field-name" date-format="date-format-string" />
        3. The date formatting is explained here: https://microsite.omniture.com/t2/help/en_US/snp/8.10.1/r_Date_Formats.html#reference_4D1F C1F6B9F44857967188496D8D335B
        • For your case it should be: %d.%m.%y (day.month.year)

         

        Regards,


        Vlad