1

I am wondering how to format dates so that:

When the start and end date are in the same month, that the start and end date is displayed like 1 - 2 March 2015

When the start and end date are in different months display dates like 12 March - 4 June 2015

When the start and end date are in different years display the dates like 12 June 2015 - 4 June 2016

Any help will be highly appreciated Thanks

3
  • more details please ,,, because this question look like a general php question and not related to the drupal ,, from where you get your date ?? where do you process the values ?? Mar 25, 2015 at 19:42
  • I have created a view that uses an Event content type that has a start and end date.
    – Ryan VDB
    Mar 25, 2015 at 19:59
  • Different date formats for a single view with multiple attachments. But it really depends on your exact needs.
    – designarti
    Mar 25, 2015 at 20:06

2 Answers 2

0

my preferred solution is to do it manually

1- install and enable views php module

2- add the start date and end date fields to the view but without display them

3- add the php global field after the date fields and write some little php code can achieve your target

0

In case anybody stumbles on this in future:

The date range formatter module does smart combination of start and end dates and allows for a wide range of formatting flexibility.

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.