mn8 Language Reference | Index    

Date

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTORS SUMMARY  OPERATORS SUMMARY  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTOR DETAILS  OPERATOR DETAILS  METHOD DETAILS

Description

Simple concept to facilitate the work with dates. Because on the World Wide Web there is no common denominator between date representation this concept has the purpose to assist the user in parsing and formatting dates. To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:

        Symbol   Meaning                 Presentation        Example
        ------   -------                 ------------        -------
        G        era designator          (Text)              AD
        y        year                    (Number)            1996
        M        month in year           (Text & Number)     July & 07
        d        day in month            (Number)            10
        h        hour in am/pm (1~12)    (Number)            12
        H        hour in day (0~23)      (Number)            0
        m        minute in hour          (Number)            30
        s        second in minute        (Number)            55
        S        millisecond             (Number)            978
        E        day in week             (Text)              Tuesday
        D        day in year             (Number)            189
        F        day of week in month    (Number)            2 (2nd Wed in July)
        w        week in year            (Number)            27
        W        week in month           (Number)            2
        a        am/pm marker            (Text)              PM
        k        hour in day (1~24)      (Number)            24
        K        hour in am/pm (0~11)    (Number)            0
        z        time zone               (Text)              Pacific Standard Time
        '        escape for text         (DelimiMerlinter)
        ''       single quote            (Literal)           '
    

Usage

Displaing the current date

            print Date.getToday.toTXT
                Tue Apr 23 12:28:40 EEST 2002
        

Parsing and reformating a date

            $date = Date.create("MMM d, ''yy", "July 10, '96")
            PRINT $date.getDate("EEE, d MMM yyyy")
                Wed, 10 Jul 1996
        

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Szabo Csaba
Location:http://mappa.mundi.net/spacemapper/repos/concepts/Date/
Inherits: Concept

Constructor List

create (Integer date)
create (String $pattern, String $date)
top

Operator List

Logical< (Date $when)
Logical> (Date $when)
Logical== (Date $when)
top

Method List

StringgetDate (String $pattern)
IntegergetTime
static DategetToday
setDate (Integer $date)
setDate (String $pattern, String $date)
StringtoTXT
StringtoXML
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Constructor Info

create (Integer date)
Parameters:
date :The value with which the new Date will be created.

Constructor which creates a new Date instance from the Integer parameter passed in. The parameter must represent the number of miliseconds after January, 1, 1970, 00:00:00 GMT.

top
create (String $pattern, String $date)
Parameters:
$pattern :The pattern for the given date.
$date :The value with which the new Date will be created.
Exceptions:
illegalParameter :
(Error)
If the parameter is not String or does not contain a valid data.
illegalFormat :
(Warning)
If the parameter is not String or does not contain a valid format.

Constructor which creates a new Date instance by parsing the value of the date using the parse rule defined by the pattern. The pattern can be formated using the date attoms.

top

Detailed Operator Info

< (Date $when)
Parameters:
$when :a date.

Tests if this date is before the specified date.

Returns true if and only if the instant of time represented by this Date concept is strictly earlier than the instant represented by when; false otherwise.

top
> (Date $when)
Parameters:
$when :a date.

Tests if this date is after the specified date.

Returns true if and only if the instant of time represented by this Date concept is strictly later than the instant represented by when; false otherwise.

top
== (Date $when)
Parameters:
$when :a date.

Tests if this date is after the specified date.

Compares two dates for equality. The result is true if and only if the argument is a Date concept that represents the same point in time, to the millisecond, as this concept.

top

Detailed Method Info

getDate (String $pattern)
Parameters:
$pattern :The pattern for the returned date.
Returns: String

Returns a string representing the date value of this concept. The returned string is formated conform the specified pattern.

top
getTime
Returns: Integer

Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

top
static getToday
Returns: Date

Returns an instance of a Date concept representing the today's date.

top
setDate (Integer $date)
Parameters:
$date :The new date to be set.

Sets the date to the specified value.

top
setDate (String $pattern, String $date)
Parameters:
$pattern :The pattern for the date to set.
$date :The new date to be set.

Set the value of date by parsing the value of the date using the parse rule defined by the pattern. The pattern can be formated using the date atoms.

top
toTXT
Returns: String

Returns a stream representing the simple text rendering of this concept.

top
toXML
Returns: String

Returns a stream representing the XML rendering of this concept.

top