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



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?



Accepted Solutions (1)

Accepted Solutions (1)



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:
  • For your case it should be: %d.%m.%y (day.month.year)




Answers (0)