
- James Taylor
Time
Time Methods
| Time() | Constructor for the Time class with no args to represent current time |
| Time() | Constructor for the Time class using seconds from 1/1/1970 |
| Time() | Constructor for the Time class using Year, Month, Day, Hour, Minute and Second as integers |
| Time() | Constructor for the Time class using another Time object |
| Time() | Constructor for the Time class using a string representation of date and a format string |
| Value() | Returns internal time value as seconds since 1/1/1970 |
| SetValue() | Sets a new internal time value using seconds since 1/1/1970 |
| IsValid() | Returns true if Time object is valid (based on parameters used to create it) |
| Year() | Returns the year from theTime value as an integer |
| Month() | Returns the month from the Time value as an integer |
| Day() | Returns the day from the Time value as an integer |
| Hour() | Returns the hour from the Time value as an integer |
| Minute() | Returns the minute from the Time value as an integer |
| Second() | Returns the second from the Time value as an integer |
| DayOfWeek() | Returns the "day of week" for the Time value as an integer (1-7) |
| DayOfWeekStr() | Returns the "day of week" for the Time value as a string |
| MonthStr() | Returns the month for the Time value as a string |
| Str() | Returns string representation of Time value given format string |
| Add() | Adds a number of seconds to the Time value |
| Add() | Adds a TimeInterval object to the Time value |
| Sub() | Subtracts a number of seconds from the Time value |
| Sub() | Subtracts a TimeInterval object from the Time value |
| Sub() | Subtracts a Time object from the Time value and returns a TimeInterval object |
Derived Classes
None
See Also
Class Hierarchy, TimeInterval, Timer
public method Time()
Parameters
None
Return Value
None
Description
Constructor for the Time class. This implementation has no arguments and sets the Time object with the current time.
Time Class
public method Time(int Seconds)
Parameters
Seconds
Number of seconds since 1/1/1970
Return Value
None
Description
Constructor for the Time class. This implementation takes a single integer argument which represents the number of seconds since January 1st, 1970.
Time Class
public method Time(int Year, int Month, int Day, int Hour, int Minute, int Second)
Parameters
Year
Year portion of the time (1970-2038)
Month
Month portion of the time (1-12)
Day
Day portion of the time (1-31)
Hour
Hour portion of the time (0-23)
Minute
Minute portion of the time (0-59)
Second
Second portion of the time (0-59)
Return Value
None
Description
Constructor for the Time class. This implementation takes six integer arguments which represent the individual pieces of the date.
Time Class
public method Time(Time SourceTime)
Parameters
SourceTime
Source time used for initialization
Return Value
None
Description
Constructor for the Time class. This implementation takes a single Time argument which is used to initialize this new Time object. Once complete, this new Time object will represent the same exact time value as the incoming source Time object.
Time Class
public method<int> Value()
Parameters
None
Return Value
Internal time value in seconds since 1/1/1970
Description
This method returns the number of seconds since 1/1/1970 corresponding to the internal time value within this Time object.
Time Class
public method<bool> SetValue(int Seconds)
Parameters
Seconds
Number of seconds since 1/1/1970
Return Value
Returns true if the new date is valid
Description
This method sets the internal time value with the number of seconds since 1/1/1970 which is passed in to the method. If the new time value is valid, the method returns true and false if not.
Time Class
public method<bool> IsValid()
Parameters
None
Return Value
Returns true if the internal time value is valid.
Description
This method returns true if the internal date value is valid and false if it is not valid.
Time Class
public method<int> Year()
Parameters
None
Return Value
Year portion of the time
Description
This method returns the Year portion of the Time value as an integer (valid value is in the range 1970 - 2038). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> Month()
Parameters
None
Return Value
Month portion of the time
Description
This method returns the Month portion of the Time value as an integer (valid value is in the range 1-12). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> Day()
Parameters
None
Return Value
Day portion of the time
Description
This method returns the Day portion of the Time value as an integer (valid value is in the range 1-31). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> Hour()
Parameters
None
Return Value
Hour portion of the time
Description
This method returns the Hour portion of the Time value as an integer (valid value is in the range 0-23). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> Minute()
Parameters
None
Return Value
Minute portion of the time
Description
This method returns the Minute portion of the Time value as an integer (valid value is in the range 0-59). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> Second()
Parameters
None
Return Value
Second portion of the time
Description
This method returns the Second portion of the Time value as an integer (valid value is in the range 0-59). If the internal Time value is invalid, this method will return zero.
Time Class
public method<int> DayOfWeek()
Parameters
None
Return Value
Day of week (1-7)
Description
This method returns the day of the week corresponding to the internal Time value as an integer in the range 1-7 (Sunday-Saturday).
Time Class
public method<string> DayOfWeekStr(bool UseFullName = true)
Parameters
UseFullName
Flag indiactes to use full name or short name
Return Value
Day of week as a string
Description
This method returns the day of the week corresponding to the internal Time value as a string. If the UseFullName flag is true, the days are in the form "Monday", "Tuesday", etc. If the flag is false, the days are in the form "Mon", "Tue", etc.
Time Class
public method<string> MonthStr(bool UseFullName = true)
Parameters
UseFullName
Flag indiactes to use full name or short name
Return Value
Month as a string
Description
This method returns the month corresponding to the internal Time value as a string. If the UseFullName flag is true, the months are in the form "January", "February", etc. If the flag is false, the days are in the form "Jan", "Feb", etc.
Time Class
public method<string> Str(string FormatString)
Parameters
FormatString
Format string to define the layout of the resultant string
Return Value
Time as a string
Description
This method returns the time based on the specified format string. The default string is "MM-DD-YYYY HH:MI:SS".
Note that this method currently ignores the format string, and uses the default string.
Time Class
public method<bool> Add(int Seconds)
Parameters
Seconds
Number of seconds to be added
Return Value
True if success
Description
This method adds the number of seconds to the internal Time value. The method returns true if successful and false if not.
Time Class
public method<bool> Add(TimeInterval Interval)
Parameters
Interval
Time interval to be added
Return Value
True if success
Description
This method adds the TimeInternal value to the internal Time value. The method returns true if successful and false if not.
Time Class
public method<bool> Sub(int Seconds)
Parameters
Seconds
Number of seconds to be subtracted
Return Value
True if success
Description
This method subtracts the number of seconds from the internal Time value. The method returns true if successful and false if not.
Time Class
public method<bool> Sub(TimeInterval Interval)
Parameters
Interval
Time interval to be subtracted
Return Value
True if success
Description
This method subtracts the TimeInternal value from the internal Time value. The method returns true if successful and false if not.
Time Class
public method<bool> Sub(Time SourceTime)
Parameters
SourceTime
Time value to be subtracted
Return Value
True if success
Description
This method subtracts the SourceTime from the Time value and returns a TimeInterval object representing the difference. The TimeInterval object can represent a positive or a negative time interval.
Time Class