Class DATETIME

Name

DATETIME  --  Class are destined to control of date and time values.

Synopsis

 DateTimeNew([<nYear>,[<nMonth>,[<nDay>,[<nHour>[,<nMin>[,<nSec>[,<nMsec>]]]]]]]) --> DATETIME object

Description

Class are destined to control of date and time values.

Attributes

<ClassName> DATETIME
<Data> Date, are some date value

Methods

ADD Addition two DateTime date-object
DATE Gets date values.
DATETIMENEW DATETIME object constructor.
DAY Gets day value.
HOUR Gets hour value.
MIN Gets minutes value.
MONTH Gets month value.
MSEC Gets millisecundes value.
NORMALIZE Normalize object DATETIME.
SEC Gets secundes value.
SUB Subtraction two DateTime date-object
TIME Gets the string in time format.
YEAR Gets year value.

Method DATETIME:ADD()

 Add(<oDt>) 	--> <oDateTime>

Add() addes <oDt> to DDATETIME-data and returns some one witch increased data. New DATETIME-data is't normalize.

Method DATETIME:DATE()

 Date() 	--> <dData>

Date() converts DATETIME data value to normal calendar date and returns it as date values.

Method DATETIME:DATETIMENEW()

 DateTimeNew([<nYear>,[<nMonth>,[<nDay>,[<nHour>[,<nMin>[,<nSec>[,<nMsec>]]]]]]]) --> DATETIME object

DateTimeNew() is constructs and returns new DATETIME object. That class can be used to control date and time values.

If some parameters not specified then date set to zero-date.

Attention! Object contain not normalized date.

Method DATETIME:DAY()

 Day() 	--> <nDay>

Day() returns day of the specified <Data> as numeric value. Not normalized.

Method DATETIME:HOUR()

 Hour() 	--> <nHour>

Hour() returns hour of the specified <Data> as numeric value. Not normalized.

Method DATETIME:MIN()

 Min() 	--> <nMin>

Min() returns minutes of the specified <Data> as numeric value. Not normalized.

Method DATETIME:MONTH()

 Month() 	--> <nMonth>

Month() returns month of the specified <Data> as numeric value. Not normalized.

Method DATETIME:MSEC()

 Msec() 	--> <nMsec>

Msec() returns millisecundes of the specified <Data> as numeric value. Not normalized.

Method DATETIME:NORMALIZE()

 Normalize() 	--> <oDateTime>

Normalize() converts DATETIME-data to normal calendar date and returns some one object.

Method DATETIME:SEC()

 Sec() 	--> <nSec>

Sec() returns secundes of the specified <Data> as numeric value. Not normalized.

Method DATETIME:SUB()

 Sub(<oDt>) 	--> <oDateTime>

Sub() subtracts <oDt> from DATETIME-data and returns some one witch decreased data. New DATETIME-data is't normalize. </para>

Method DATETIME:TIME()

 Time() 	--> <sTime>

Time() returns the normalized time value of the specified <Data> as string value in the format <hh:mm:ss:ms> or returns "00:00:00:00" if DateTime object contained zero-date. When <hh> is two-digit hours value, <mm> is two-digit minutes value, <ss> is two-digit secundes value and <ms> is two-digit milisecundes value.

Method DATETIME:YEAR()

 Year() 	--> <nYear>

Year() returns year of the specified <::Data> as four-digit numeric value. Not normalized.

Example:

 /* Create */
 dt := DateTimeNew(2003, 01, 01) //
 ? dt:Year()	// --> 2003
 ? dt:Month()	// --> 01
 ? dt:Day()	// --> 01
 
 dt := DateTimeNew()
 ? dt:Year()	// --> 0
 ? dt:Month()	// --> 0
 ? dt:Day()	// --> 0
 ? dt:Date()     // --> 02-12-0001
 
 dt := DateTimeNew(2000)
 ? dt:Year()	// --> 2000
 ? dt:Month()	// --> 0
 ? dt:Day()	// --> 0
 ? dt:Date()     // --> 30-11-1999
 
 
 
 /* Normalize */
 dt := DateTimeNew(2003, 03, 41)
 ? dt:Day()		// --> 41
 ? dt:Normalize()	// --> DateTime object
 ? dt:Day()		// --> 10
 ? dt:Date()		// --> 10-04-2003
 
 dt := DateTimeNew(0, 0, 0)
 ? dt:Year()		// --> 0
 ? dt:Month()		// --> 0
 ? dt:Day()		// --> 0
 ? dt:Normalize()	// --> DateTime object
 
 ? dt:Year()		// --> 0001
 ? dt:Month()		// --> 12
 ? dt:Day()		// --> 02
 ? dt:Date()		// --> 02-12-0001
 
 /* Control */
 dt := DateTimeNew(2003, 03, 01)
 ? dt:Year()	// --> 2003
 ? dt:Month()	// --> 03
 ? dt:Day()	// --> 01
 dt2 := DateTimeNew(0, 0, 54)
 
 dt:Add(dt2)
 ? dt:Year()	// --> 2003
 ? dt:Month()	// --> 03
 ? dt:Day()	// --> 55
 ? dt:Date()	// --> 24-04-2003
 
 
 dt := DateTimeNew(2003, 03, 01)
 ? dt:Year()	// --> 2003
 ? dt:Month()	// --> 03
 ? dt:Day()	// --> 01
 dt2 := DateTimeNew(0, 0, 54)
 
 dt:Sub(dt2)
 ? dt:Year()	// --> 2003
 ? dt:Month()	// --> 03
 ? dt:Day()	// --> -53
 ? dt:Date()	// --> 06-01-2003
 

Platforms

No dependies of platform.