Cookbook: Use a special Date-Format

This Cookbook shows, how you can use a special Date-Type as you like it. You can select a different "Date-Format" for every language for this Date-Type.

Cookbook:

Step 1: Before we start

Visit "http://example.com/admin/config/regional/date-time/formats" and click on "Add format".
Enter the Format string, e.g. "D M j G:i:s T Y". The format characters like "i" or "T" you can find at "http://www.php.net/manual/en/function.date.php".
e.g.:
The format "l F j, Y g:ia T" is displayed as "Tuesday February 28, 2012 10:29am PST".

Step 2: Add a new "date"-type

Visit "http://example.com/admin/config/regional/date-time" and click on "Add date type". Type the "Date type"-name, e.g. "Event" and then chooce use your new "date format" from the last step.

Step 3: For other languages

If you use other languages than English on your website:
Define a special "date format" for every language using step 1, if needed.
Visit "http://example.com/admin/config/regional/date-time/locale" and select a "date format" for every language for your "date type" of step 2.

Step 4: Use this format

Use this "date type" from step 2 to show your event date and time in the event-node.

Notes:

[1]: In German you can set like "DIN 5008:2005-05":
Short date-format: "d.m.Y - H:i"
Medium date-format: "D., d.m.Y - H:i"
Long date-format: "l, j. F Y - H:i"

[2]: I may be nice to add a Date-Type "Only day" and/or "Only time" to show your event date on the calendar-views.

Cookbook: set up Japanese era date on a multilingual site

This Cookbook shows how you can set up a date field to use a different Date format for each language. We will assume there are two languages

Guide maintainers

wusel's picture