HS Localize Date

Developer

Kevin Smith - Hearsay

3rd Party (Free)

453 downloads (last 90 days)

MIT License Download v1.1.0

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Cater to your site's visitors with localized dates and times.

HS Localize Date allows you to display dates and times localized based on the member's preference for Time Formatting. (Members can set this preference in their Control Panel under Personal Settings > Localization.)

It's quite simple to use. Just wrap the plugin's tags around any tag that outputs UNIX timestamp (such as {current_time}) or around a raw UNIX timestamp itself.

Example

{exp:hs_localize_date}{current_time}{/exp:hs_localize_date}

If the date right now is October 19, 2010, then this would output the following for a user with their Time Formatting preference set just so.

United States:  October 19, 2010
European Union:  19 October 2010

Parameters

time=""

- Set to "include" to tack on the time after the date. This is locale-specific.
- Set to "only" to output the time by itself. This is locale-specific.

separator=""

- By default, the date and time are separated by '@'. Use this parameter to change it to whatever you like.

us="" (e.g. us="%D, %F %d, %Y - %g:%i:%s")*

- Provide custom date formatting to apply when the Time Formatting preference is set to United States. This overrides the default US date formatting.

eu="" (e.g. eu="%D, %F %d, %Y - %g:%i:%s")*

- Provide custom date formatting to apply when the Time Formatting preference is set to European Union. This overrides the default EU date formatting.

custom="" (e.g. custom="%D, %F %d, %Y - %g:%i:%s")*

- Provide custom date formatting that will override all other parameters and config.php settings.

* For parameters using date formatting codes, full documentation is found in the "Date Variable Formatting" page in the ExpressionEngine docs. The plugin ignores the 'time' and 'separator' parameters if you use either 'us', 'eu', or 'custom'.

Global Settings

I wanted this to remain a simple plugin, so to keep it from growing into a module, you can create global settings that will override the defaults of the plugin.

So for example, the default for US dates in the plugin produces 'October 19, 2010', but suppose you want to have a different look on your site. Easy: just add a few lines to your config.php file.

These are the config items, all of them optional, with examples.

$config['hsld_us_date'] = '%n/%j/%y';
$config['hsld_us_time'] = '%g:%i%a';
$config['hsld_eu_date'] = '%n/%j/%y';
$config['hsld_eu_time'] = '%H:%i';
$config['hsld_include_time'] = 'include'; (Identical in function to 'time' parameter.)
$config['hsld_separator'] = 'at'; (Identical in function to 'separator' parameter.)

* Just like with the parameters, you'll notice that the date formatting conforms to the "Date Variable Formatting" page in the ExpressionEngine docs.

Note: Global settings override the plugin's default settings, and plugin tag parameters override both global settings and the plugin's default settings.

Download HS Localize Date

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.1.0 Oct 23, 2010

HS Localize Date Links

This entry was created October 20, 2010, 1:02 pm.
This entry was last updated October 28, 2010, 3:29 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

There are no reviews for this add-on yet.

What are you waiting for? Rate it and review it!