Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Date and Time

  • Last UpdatedNov 24, 2023
  • 2 minute read

These python classes handle dates and time.

Class KcsDate.Date

The class holds information about date

Parameters and attributes:

_Year

integer

Year

_MonthY

integer

Month

_Day

integer

Day

Methods:

Class constructor:

Date(<integer year>, <integer month>, <integer day>)

This constructor will create instance of Date class.

__cmp__

Used to compare two Date objects.

__rpr__

Used to return string representation of Date object.

SetDate(year, month, day)

SetDate(Date)

Sets date.

GetDate()

Returns date as tuple containing three integers:

(year, month, day)

Example:

import KcsDate

a = KcsDate.Date(2001, 10, 10)

print a

a.SetDate(2000, 10, 11)

print '%04i %02i %02i' %.GetDate()

see also:

# Example: kcs_ex_ass01.py

# Example: kcs_ex_db01.py

Class KcsTime.Time

The class holds information about time. It is used with other Vitesse classes.

Parameters and attributes:

Hour

integer

Hour part

Minute

integer

Minute part

Second

integer

Second part

Hundredths

integer

Hundredth of second

Constructor:

Time(<hour>,<min>,<sec>,<hund>)

This constructor will create instance of Time class. Parameters are defined as above. Default values are 0.

Methods:

SetTime (hour, min, sec, hund)

Sets time from four parts. Parameters are defined as above.

SetTime (time)

Sets time from another Time instance.

time

Time

Time object to copy

GetTime ()

(integer, integer, integer, integer)

Returns time as tuple:

(hour, minute, second, hundredths)

Class protocols:

__cmp__

Used to compare two Time objects.

__repr__

Used to return string representation of Time object.

 

Example:

import KcsTime

a = KcsTime.Time(05, 10, 10, 00)

print a

a.SetTime(05, 10, 11, 00)

print '%02i:%02i:%02i.%02i' %GetTime()

see also:

# Example: kcs_ex_db01.py

Class KcsDateTime.DateTime

The class holds information about date and time. This class inherits from Date and Time classes.

Parameters and attributes:

None.

Methods:

Class constructor:

DateTime(<integer year>, <integer month>, <integer day>, <integer hour>, <integer minute>, <integer second>, <integer hundredths>)

This constructor will create instance of DateTime class.

__cmp__

Used to compare two DateTime objects.

__repr__

Used to return string representation of DateTime object.

SetDateTime(year, month, day, hour, min, sec, hund)

SetDateTime(DateTime)

Sets date time.

GetDateTime()

Returns time as tuple containing seven integers:

(year, month, day, hour, minute, second, hundredths)

Examples:

import KcsDateTime

a = KcsDateTime.DateTime(2001, 10, 19, 05, 10, 10, 00)

print a

see also:

# Example: kcs_ex_db01.py

Related Links
TitleResults for “How to create a CRG?”Also Available in