In Page > Fields > Configure field > Formats, "Custom date format" does not appear in the dropdown list.

List content is:
Default
Long
Medium
Short
ISO
Timestamp
Feed
iCal
As Time Ago

This is not a duplicate of #243408: Custom date field formats not processed.

Thanks,

Vianney Stroebel
Co-org.net - Développement Drupal - Paris.

CommentFileSizeAuthor
#31 cache_to_clear.jpg113.73 KBarlinsandbulte

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Date
Version: 6.x-2.0-beta4 » 6.x-2.x-dev
Component: Views Data » Miscellaneous

If your problem deals exclusively with fields or filters provided by another module (CCK, Image, VotingAPI are common) please post the issue under the queue for that module first; all modules are responsible for telling Views about their own fields. It's possible Views IS at fault, but the module maintainers are the best people to make that determination, and they can kick the issue into the Views queue with an explanation of what's wrong if that is the case.

Of course, since you don't say what field you're talking about, I can only tell that you're talking about date.module because it uses ISO and iCal, things which are not part of views.module itself but are provided by date.

Viybel’s picture

Title: "Custom date format" not in the list » "Custom format" not available in Views

Sorry for that. I thought this was handled by Views but I realize it probably is a bug from the Date module (which I do use).

I'm a great admirer of your work and I'll try to file decent bug reports in the future...

Thanks,

Vianney Stroebel
Co-org.net - Développement Drupal - Paris.

karens’s picture

Status: Active » Closed (works as designed)

There is no 'custom date format', so that's why it doesn't show up in the list. See my response to the other issue you filed.

jeff h’s picture

Component: Miscellaneous » Date CCK Field
Category: bug » support
Status: Closed (works as designed) » Active

Sorry, I have the same question, and I can't find any other relevant post by Viybel :(

The best I can gather is that there's been a deliberate decision to move the custom date format to a separate config setting for each date field. Unfortunately that makes me want to poke myself in the eye for the following reason;

Let's say I'm building a view which displays a bunch of nodes on my site, which contain a special CCK date field called "finished on". I want the "finished on" field to be displayed in my results table as such "31 March 2009". Easy, set up a short date format to look like this, because I will want this all over the site in other places too.

However, let's say I then want to group my view results by the month each node was "finished on". I need a field in my views results which contains nothing but the date's month. I certainly won't find this useful anywhere else in my site, nor even anywhere else my CCK type is being displayed.

It seems I can no longer do this by creating a one-off custom format at a view field level, which is not only a bit frustrating as mentioned above, but inconsistent with the general behaviour of other dates in views eg node created, node modified.

Am I missing something?

Thanks for an otherwise fantastic module :)

Jeff

andrewsuth’s picture

Hi KarenS,

Firstly, the more I use the Date module the more I realise how well it's been developed and just how flexible it is. When I stumbled across the option to create custom date and time formats I was very impressed. Great work, keep it up!

I had the same problem as outlined in this issue, where my custom date and time format would not appear as a format option in Views. In fact, I was about to open my own issue when I found this one - so I went to verify my View again and magically the custom date and time field I created was now available as a format type.

All I had done before was go to the Content-Type with the CCK Date and re-save the Date field. Perhaps this was just a coincidence, but now it appears as an option in Views. I am using the latest Date 6.x-2.1 module with Views 6.x-2.4

@jeff h: Try this out and see if it works for you too.

The format for CCK Date in Views now appears like this:

Format: *

  • Default
  • As Time Ago
  • Long
  • Medium
  • Short
  • Calendar Day

Where Calendar Day is the custom Date format I created.

This feature is brilliant as it doesn't limit you to the standard formats for Views (imagine if you need more formats than just Short, Medium and Long). For me, this means a lot less fiddly Views field theming - it's a real time saver.

Once again, great work KarenS!

karens’s picture

Status: Active » Fixed

This should be working right.

SeanBannister’s picture

Andrewsuth: Your spot on, I had the same problem with the custom date format not displaying. All I did is edited the content type that the date field was assigned to and hit save. Now it displays in my Views.

Not exactly sure what the save button is doing to expose the field to views but it would be handy if it happened when you save the custom format.

andrewsuth’s picture

So there's a few of us who have experienced this minor issue.

Perhaps this would be worth looking into KarenS?

roald’s picture

Had the same minor issue - fixed by re-saving the content type.
Thanks for awesome work :)

fred0’s picture

I can confirm the behavior/fix from #5.
Additionally, if you go in to the date field in the content type and change the default format, that change will override the choice in Views. I had to then go into Views, open the field settings and hit update to get it to use the choice in Views again.

andrewsuth’s picture

All that is required is to flush the caches and your new custom Date will magically appear in Views.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

JayKayAu’s picture

For the benefit of people who are new to Drupal, the way you can clear your cache in Drupal 6 is by going to: Admin > Site Configuration > Performance, where you'll find a button that does this.

I had exactly the same problem as described above, and I'm wondering (coming from a basis of zero knowledge of Drupal's caching mechanism) if it's possible/reasonable to flush (parts of) the cache automatically when you create a new Custom Date Format?

andrewsuth’s picture

@JayKayAu: That makes a lot of sense to me.

@KarenS: What do you think about getting this into the latest DEV?

kmonty’s picture

Status: Closed (fixed) » Active

I can confirm that clearing the cache solved the issue.

Maybe we can change the module to clear the cache when saving a format?

kmonty’s picture

Category: support » bug
Priority: Normal » Minor
kmonty’s picture

Title: "Custom format" not available in Views » "Custom format" not available in Views immediately - Clearing the cache is required
arlinsandbulte’s picture

Note: Marked #578964: Disable caching for field editing as duplicate of this issue.

Anonymous’s picture

I can confirm this bug, as I stated in #578964: Disable caching for field editing

koyama’s picture

+1 subscribe

harcher’s picture

Happened to me too.

Flushed the cache and worked.

However, this is not ideal and should be fixed.

Drupal 6.14
Views 6.x-2.6
Date 6.x-2.4

karenm’s picture

I had this same issue, however both running cron and clearing the views cache did not allow the custom format to appear in content types (when configuring a field under cck's manage fields), nor appear in the format list in views.

It was not until I re-saved an unchanged configuration of the field in question within a content type already containing the field that it updated things.

Drupal 6.15
Views 6.x-2.8
Date 6.x-2.4

endiku’s picture

Concur, the cache needs to be flushed for a newly created custom date format to appear in the format list for a date field in views. Not the end of the world but there it is.

gilcreque’s picture

I'm experiencing this issue and clearing the cache is not working for me. Neither is saving the view and then going back in to edit it.

Anonymous’s picture

Best issue title ever, googled "custom date format views" and BOOM, done.

RE: #24 make sure you assigned the custom format to have a format type on this page: /admin/settings/date-time/formats/configure --- and then again clear your cache

Melissamcewen’s picture

Clearing the cache did not work for me, but opening up the CCK content type and saving it did. Strange.

danny_joris’s picture

Clearing the cache does not help for me. I also don't have a cck date field enabled - I don't need that. I need my custom date format to show up in the 'node: post date' field.

Edit: just as a test, I added a cck date field to my content type. Here I can perfectly select the new custom date format. Both in the cck field and views. In views I placed this field above the 'node: post date' , but 'node: post date' still does not show me the custom date format.

geerlingguy’s picture

Same as #26 - clearing cache didn't work, but re-saving content type worked like a charm.

Jo_’s picture

+ subscribe
As #26, re-saving content type worked for me. Wasted hours trying to fix this yesterday. :/

arlinsandbulte’s picture

Just a quick note: this is still valid for Date 6.x-2.6 & today's -dev
It seems clearing cid 'content_type_info:en' in table 'cache_content' is all that is needed to fix this.

arlinsandbulte’s picture

StatusFileSize
new113.73 KB
zkrebs’s picture

I might have old code, but I just edited the content type's field and hit save, then it worked.

adellefrank’s picture

Component: Date CCK Field » Code

I could not get this to work with my content type's default field for created date. So, in Views, I did the following for the post date field:

  1. Check "Rewrite the output of this field" and put the [created] token in the box as what should be written out.
  2. Under, "Date format", choose "Custom" and type in the custom PHP format. For example, I needed the date to be output in this format: 2012-09-27 13:06:01 -0400, so I used this date code: "Y-m-d H:i:s O"
korven’s picture

Version: 6.x-2.x-dev » 6.x-2.9

This is still an issue with Date 2.9. Clearing the cache works and lets you see the new date format in Views.

Carolina Tiger Rescue’s picture

I found under Regional and language where I could set up the custom date type, but the format I need is not listed as one of the options. I just want the "time" value of the date to use in the month view of a calendar- so that the date is not taking up space when the date can obviously be seen in the month layout of the calendar.

What am I missing here?

Carolina Tiger Rescue’s picture

I figured it out- you go to COnfiguration- Regional and Language- Date and Time, then click on the "Formats" tab. Add the php format code, e.g. n/d is the format I use to create a date type of Birthday. Then go back to the types, Add Date Type- and then choose the example format you just created on the Formats tab and give your Date Type a name.

I did this in Drupal 7

oh, and BTW, I also created a type by editing the includes/dates.inc file, but think the method described above is obviously the way to go

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.