| AngelScript |

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
datetime object

Path: /sdk/add_on/datetime/

The `CDateTime` class provides a way for scripts to get the system date and time.

Register the type with the `RegisterScriptDateTime(asIScriptEngine*)` function.

Note
  This class requires C++11 or later to compile.

# Public C++ interface

class CDateTime
{
public:
// Constructors
CDateTime();
CDateTime(const CDateTime &other);
// Copy the stored value from another any object
CDateTime &operator=(const CDateTime &other);
// Accessors
asUINT getYear() const;
asUINT getMonth() const;
asUINT getDay() const;
asUINT getHour() const;
asUINT getMinute() const;
asUINT getSecond() const;
};

# Public script interface

      class datetime
      {
        datetime();
        datetime(const datetime &in other);

        datetime &opAssign(const datetime &in other);

        uint get_year() const;
        uint get_month() const;
        uint get_day() const;
        uint get_hour() const;
        uint get_minute() const;
        uint get_second() const;
      }

datetime()
datetime(const datetime &in other)

The default constructor initializes the object with the current system time.

The copy constructor copíes the content of the other object.

datetime &opAssign(const datetime &in other)

The assignment operator copies the content of the other object.

uint get_year() const

Returns the year of the date stored in the object.

uint get_month() const

Returns the month of the date stored in the object. The range is 1 to 12, i.e. 1 is January, 12 is December, and so on.

uint get_day() const

Returns the day of the month of the date stored in the object.

uint get_hour() const

Returns the hour of the time stored in the object. The range is 0 to 23.

uint get_minute() const

Returns the minute of the time stored in the object. The range is 0 to 59.

uint get_second() const

Returns the second of the time stored in the object. The range is 0 to 59.