-
Notifications
You must be signed in to change notification settings - Fork 9
DateTime
(Formerly known as GetTime
, which is now obsolete)
readonly static DateTime* DateTime.Now;
Gets the current system time. You could use this for timing a loop, or for effects like telling the player to go to bed, and so on.
A DateTime object is returned, which contains various properties that you can use.
Note that the DateTime object that you get will not be kept up to date with the current time; it will remain static with the time at which you called DateTime.Now.
Example:
DateTime *dt = DateTime.Now;
Display("The date is: %02d/%02d/%04d", dt.DayOfMonth, dt.Month, dt.Year);
Display("The time is: %02d:%02d:%02d", dt.Hour, dt.Minute, dt.Second);
will display the current date and time in 24-hour format
See also: DateTime.DayOfMonth
,
DateTime.Hour
,
DateTime.Minute
,
DateTime.Month
,
DateTime.RawTime
,
DateTime.Second
,
DateTime.Year
readonly int DateTime.DayOfMonth;
Gets the day of the month represented by the DateTime object. This will be from 1 to 31, representing the current day within the month.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
readonly int DateTime.Hour;
Gets the hour represented by the DateTime object. This will be from 0 to 23, representing the hour in 24-hour format.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
readonly int DateTime.Minute;
Gets the minute represented by the DateTime object. This will be from 0 to 59, representing the minute in 24-hour format.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
readonly int DateTime.Month;
Gets the month represented by the DateTime object. This will be from 1 to 12, representing the month of the year.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
(Formerly known as GetRawTime
, which is now obsolete)
readonly int DateTime.RawTime;
This function returns the raw system time, as the number of seconds since January 1970. While this value is not useful in itself, you can use it to calculate time differences by getting the value at the start of the game, for example, and then getting the value later on, and the difference between the two is how much time has elapsed.
NOTE: Because this accesses the real-time clock on the users' system, it is not a good idea to use this for long term timing tasks, since if the user saves the game and then restores it later, the Time value returned by this function will obviously include the difference when they were not playing.
Example:
DateTime *dt = DateTime.Now;
int start_time = dt.RawTime;
Wait(120);
dt = DateTime.Now;
Display("After the wait it is now %d seconds later.", dt.RawTime - start_time);
should display that 3 seconds have elapsed.
See also: DateTime.Now
,
SetTimer
readonly int DateTime.Second;
Gets the second represented by the DateTime object. This will be from 0 to 59, representing the second.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
readonly int DateTime.Year;
Gets the year represented by the DateTime object. This is the full year, for example 2005.
Example: For an example, see DateTime.Now
.
See also: DateTime.Now
Getting Started in AGS
Editor
- New Game templates
- Editor Preferences
- General Settings
- Default Setup
- Colours Editor
- Room Editor
- Character Editor
- Cursor Editor
- Dialog Editor
- Font Preview
- GUI Editor
- Inventory Items Editor
- View Editor
- Sprite Manager
- Music and sound
- Voice speech
- Script Modules
- System limits
- Log Panel
- Plugins
- Other Features
Engine
Scripting
- Scripting Tutorial
- Scripting Language
-
Scripting API
- Script API Overview
- Standard Constants
- Standard Enumerated Types
- Standard Types
- Game variables
- Global arrays
- Global event handlers
- repeatedly_execute / repeatedly_execute_always
- Custom dialog options rendering
- Global functions: general
- Global functions: message display
- Global functions: multimedia actions
- Global functions: palette operations
- Global functions: room actions
- Global functions: screen effects
- Global functions: wait
- AudioChannel functions and properties
- AudioClip functions and properties
- Camera functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- Dictionary functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game functions and properties
- GUI functions and properties
- GUI control functions and properties
- GUI Button functions and properties
- GUI InvWindow functions and properties
- GUI Label functions and properties
- GUI List Box functions and properties
- GUI Slider properties
- GUI Text Box functions and properties
- Hotspot functions and properties
- Inventory item functions and properties
- Maths functions and properties
- Mouse functions and properties
- Object functions and properties
- Overlay functions and properties
- Parser functions
- Region functions and properties
- Room functions and properties
- Screen functions and properties
- Set functions and properties
- Speech functions and properties
- String functions
- System functions and properties
- TextWindowGUI functions and properties
- ViewFrame functions and properties
- Viewport functions and properties
- Obsolete Script API
- Event Types
- Key code table
- Audio in script
Legal Notice
Getting in touch
Misc