1

I have an INT field with a Unix timestamp. When I add this field to a view, I do not get any date formatting options. I just get options for the thousands market (non, comma, etc). How do I get Drupal to recognize that this is a date field?

I am using the Date modules.

1

I have an INT field that's the problem. You need to use a Date field and not an integer field. As INT fields are not meant/designed to hold dates. Drupal cannot know that your INT it's actually a time stamp and not a number.

As per my Q here: Unix timestamp time is not saving to DB, I was never able to figure out how to save unix time to the DB.

So you could stick with the INT field and use jQuery to convert your unix time to what ever time you need. The big downside is that if you will not be able to sort or filter by a certain month or year.

The better solution is to use Date field, but transform your Unix time stamp to some format accepted by the Date field. By using PHP, with hook_node_presave or using jQuery.

In conclusion, use a date field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.