Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I was wondering if it is possible to have some option regarding how the start date and end date is displayed. I've been using module for our events. And I notice that the start date and end date are displayed separately, which might be not as concise as the format like January 1-2, 2012. There are surely many cases when it is better to display the dates separately, so what I'm suggesting is just to make it as an option.
Thank you!
Comments
Comment #1
chucksimply CreditAttribution: chucksimply commentedAre you referring to the formatting of the start and end date? Because I think this would solve the problem. If the start and end date could each be formatted differently, you could create a wider variety of simpler date start-end combinations. For instance in the above case... Start Date = January 1, End Date = 2, 2012. The combination would be January 1-2, 2012. This is doable in Views, but not in the standard date field. Would love to see it.
Comment #2
DrupalDan CreditAttribution: DrupalDan commentedHi ChuckSimply, thanks for your response. Yes, I'm looking for an easy way to make start date and end date shown as "January 1-2, 2012" but don't know how to do it. Can you give me some more information?
Thanks
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedI have a similar problem, but my end date is not mandatory. If you always have an end date, you can
1. Add a Start Date to the view, format according and exclude from View
2. Add a End Date to the view, format according and exclude from View
3. Add a field which combines the two in a Rewrite rule.
Comment #4
dotmundo CreditAttribution: dotmundo commentedWhat if the date goes from Jan 30 to Feb 1? It might be best to do this in the field template using PHP.
Comment #5
JKingsnorth CreditAttribution: JKingsnorth commentedMarked #1915872: Allow the format of Start and End Dates to be changed. as a duplicate.
Comment #6
jphelan CreditAttribution: jphelan commentedThis is probably not the best way to do it but in views create a template file for your date field and output your date field as "Plain" and "Both Start and End Dates". Then in your template file put the code below. This accounts for dates the span months or years. Format the date output to your liking date().
Comment #7
localnetwork CreditAttribution: localnetwork as a volunteer and commented