timestring A Yii widget for displaying a human friendly view of two dates

  1. Requirements
  2. Usage

This extension is a Widget that takes two dates and displays them in a human friendly string.

Here are some example outcomes ~~~ "2012-12-25" and "2012-12-31" will show as "25 to 31 Dec 2012" "2012-12-25" and "2013-01-15" will show as "25 Dec 2012 to 15 Jan 2013" "2013-01-05" and "2013-02-10" will show as "05 Jan to 10 Feb 2013" ~~~

Requirements

Yii 1.1 or above

Usage

  1. Copy the extension to your protected/extensions folder.
  2. In a View file, insert as a Widget using "YYYY-mm-dd" formatted parameters for 'startDate' and 'endDate'. Set 'duration' to true to show the number of days in brackets as a suffix.
$this->widget('TimeString', array(
	'startDate'=>$data->start_date, // assuming $data->start_date is "2012-12-25"
	'endDate'=>$data->end_date,     // assuming $data->end_date is "2012-12-31"
	'duration'=>true,
));
3 0
9 followers
371 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Date and Time
Tags: date
Developed by: CobraF
Created on: Dec 25, 2012
Last updated: 5 years ago

Downloads

show all

Related Extensions