PHP Classes

File: readme.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Neil Morgan  >  nmDate  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Documentation for nmDate
Class: nmDate
Date arithmetic operations and format conversion
Author: By
Last change:
Date: 10 years ago
Size: 2,844 bytes


Class file image Download
Date calculation and manipulation
Copyright (c) 2004, Neil Morgan

This class was created using algorithms for Julian and Gregorian
date manipulation found on the Internet.  A search of Google using 
"Julian Date" or "Julian Date Algorithm" would provide further

Requirements: PHP4 or better (not tested on PHP3).

Date Conversion to and from Julian representation.
Date Conversion to and from Gregorian representation.
Date and Time calculations.
Interval between given dates.

Must specify long year i.e. 1999 or 2004 instead of '99 or '04
Accepts dates in the UK format i.e. dd/mm/yyyy only.
Does not support dates created in the US format i.e. mm/dd/yyyy.
Date field separators must be either '/', '.' or '-'.

There are six methods of constructing the nmDate object.
$var = new nmDate();
	Creates an object with date/time of now.

$var = new nmDate('dd/mm/yyyy');
	Creates an object with specified date at midnight.

$var = new nmDate('TS', Timestamp);
	Creates an object with specified Timestamp.

$var = new nmDate('dd/mm/yyyy','HH:MM:SS');
	Creates an object with specified date and time.

$var = new nmDate(dd,mm,yyyy);
	Creates an object with specified days, months and years.

$var = new nmDate(dd,mm,yyyy,HH,MM,SS);
	Creates an object with specified days, months, years, 
	hours, minutes and seconds.

$var->ToJul([ ['AD'] | ['BC'] ]);
	Converts the constructor date to Julian format.  Defaults to 'AD'.

	Converts Julian date to Gregorian format.

	Date calculations (addition and subtraction)

	Returns the day of the week i.e. Monday, Tuesday, etc.

$var->GetDateDMY([ [ true ] | [ false ] , [ <Separator> ] ] );
$var->GetDateMDY([ [ true ] | [ false ] , [ <Separator> ] ] );
	Returns date in UK or US format.
	Parameter 1 specifies month in digit or named form i.e. 04 or April.
		False for digit (default), True for named.
	<Separator> specifies date field separator, defaults to '/'.

$var->SetTime([ [ HH ] , [ MM ] , [ SS ] ]);
	Sets the time.  Default is Midnight i.e. 0 hours, 0 minutes and 0 seconds.

$var->GetTime( [ <Separator> ] ); 
	Returns the time separated by <Separator> (defaults to ':').

	Time calculations (addition and subtraction).
	Date safe.

	Calculates the difference in seconds between the current object's date
	and the given date/time.