note 109035 added to function.date

From: Date: Thu, 14 Jun 2012 16:36:42 +0000
Subject: note 109035 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-188614@lists.php.net to get a copy of this message
Here is a cool Date class to implement the date function: <?php /* * @author Gchats http://www.gchats.com * * Date class */ class Date { private $shortDateFormat = "F j, Y"; private $longDateFormat = "F j, Y, g:i a"; private $timestamp = 0; /** * Default constructor * * @param integer $timestamp unix time stamp */ function __construct($timestamp = 0) { $this->timestamp = $timestamp; } /** * Returns the given timestamp in the constructor * * @return integer time stamp */ public function getTime() { return (int) $this->timestamp; } /* * Returns long formatted date of the given timestamp * * @access public * @return string Long formatted date */ public function long() { if ( $this->timestamp > 0 ) { return date ( $this->longDateFormat , $this->timestamp ); } else { return ""; } } /* * Returns short formatted date of the given timestamp * * @access public * @return string Short formatted date */ public function short() { if ( $this->timestamp > 0 ) { return date ( $this->shortDateFormat , $this->timestamp ); } else { return ""; } } public function __toString() { return $this->timestamp; } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 82.26.108.4 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/109035 Del: integrated -- https://master.php.net/note/delete/109035/integrated Del: useless -- https://master.php.net/note/delete/109035/useless Del: bad code -- https://master.php.net/note/delete/109035/bad+code Del: spam -- https://master.php.net/note/delete/109035/spam Del: non-english -- https://master.php.net/note/delete/109035/non-english Del: in docs -- https://master.php.net/note/delete/109035/in+docs Del: other reasons-- https://master.php.net/note/delete/109035 Reject -- https://master.php.net/note/reject/109035 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188614) next »