Alpha Framework alpha--model--types
[ class tree: alpha--model--types ] [ index: alpha--model--types ] [ all elements ]

Class: Date

Source Location: /model/types/Date.inc

Class Date

Class Overview

Implements interfaces:

The Date complex data type

Located in /model/types/Date.inc [line 51]

AlphaType
   |
   --Date
Author(s):
  • John Collins <dev@alphaframework.org>
Information Tags:
Version:  $Id: Date.inc 1341 2011-03-17 15:02:02Z johnc $
Copyright:  

Copyright (c) 2011, John Collins (founder of Alpha Framework). All rights reserved.

 Redistribution and use in source and binary forms, with or
 without modification, are permitted provided that the
 following conditions are met:

 * Redistributions of source code must retain the above
   copyright notice, this list of conditions and the
   following disclaimer.
 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the
   following disclaimer in the documentation and/or other
   materials provided with the distribution.
 * Neither the name of the Alpha Framework nor the names
   of its contributors may be used to endorse or promote
   products derived from this software without specific
   prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Since:  1.0
License:  The BSD License

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From AlphaType

AlphaType::getHelper()
Used to get the validation helper message string
AlphaType::setHelper()
Set the validation helper text
AlphaType::__toString()
Used to convert the object to a printable string

[ Top ]
Property Summary
string   $helper   The error message returned for invalid values

[ Top ]
Method Summary
Date   __construct()   Constructor. Leave $date param empty to default to now.
integer   getDay()   Get the day part
string   getEuroValue()   Get the date value as a string in the format "DD/MM/YYYY"
integer   getMonth()   Get the month part
string   getRule()   Get the validation rule
integer   getUnixValue()   Return the value in UNIX timestamp format
string   getUSValue()   Get the date value as a string in the format "MM/DD/YYYY"
string   getValue()   Get the date value as a string in the format "YYYY-MM-DD"
string   getWeekday()   Get the textual weekday part, e.g. Monday
integer   getYear()   Get the year part
void   populateFromString()   Accepts a full date string in YYYY-MM-DD format and populates relevent Date attributes.
void   setDateValue()   Set the Date attributes to match the three values provided
void   setRule()   Set the validation rule
void   setValue()   Accepts a full date string in ISO YYYY-mm-dd format and populates relevent Date attributes.

[ Top ]
Properties
string   $helper = 'Not a valid date value! A date should be in the ISO format YYYY-MM-DD.' [line 98]

The error message returned for invalid values

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Methods
Constructor __construct  [line 107]

  Date __construct( [string $date = '']  )

Constructor. Leave $date param empty to default to now.

Parameters:
string   $date:  Date string in the ISO format YYYY-MM-DD.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  IllegalArguementException

[ Top ]
getDay  [line 241]

  integer getDay( )

Get the day part


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getEuroValue  [line 201]

  string getEuroValue( )

Get the date value as a string in the format "DD/MM/YYYY"


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getMonth  [line 231]

  integer getMonth( )

Get the month part


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getRule  [line 317]

  string getRule( )

Get the validation rule


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getUnixValue  [line 191]

  integer getUnixValue( )

Return the value in UNIX timestamp format


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getUSValue  [line 211]

  string getUSValue( )

Get the date value as a string in the format "MM/DD/YYYY"


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getValue  [line 181]

  string getValue( )

Get the date value as a string in the format "YYYY-MM-DD"


API Tags:
Access:  public

Information Tags:
Since:  1.0

Implementation of:
AlphaTypeInterface::getValue()
Get the value

[ Top ]
getWeekday  [line 251]

  string getWeekday( )

Get the textual weekday part, e.g. Monday


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getYear  [line 221]

  integer getYear( )

Get the year part


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
populateFromString  [line 262]

  void populateFromString( string $date  )

Accepts a full date string in YYYY-MM-DD format and populates relevent Date attributes.

Parameters:
string   $date: 

API Tags:
Access:  public

Information Tags:
Throws:  IllegalArguementException
Since:  1.0

[ Top ]
setDateValue  [line 152]

  void setDateValue( integer $year, integer $month, integer $day  )

Set the Date attributes to match the three values provided

Parameters:
integer   $year: 
integer   $month: 
integer   $day: 

API Tags:
Access:  public

Information Tags:
Throws:  IllegalArguementException
Since:  1.0

[ Top ]
setRule  [line 327]

  void setRule( string $rule  )

Set the validation rule

Parameters:
string   $rule: 

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
setValue  [line 139]

  void setValue( string $date  )

Accepts a full date string in ISO YYYY-mm-dd format and populates relevent Date attributes.

Parameters:
string   $date: 

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  IllegalArguementException

Implementation of:
AlphaTypeInterface::setValue()
Set the value of the type

[ Top ]

Documentation generated on Thu, 17 Mar 2011 16:44:00 +0000 by phpDocumentor 1.4.3