-
Notifications
You must be signed in to change notification settings - Fork 0
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 Reference
- Music and sound
- Distributing your game
- Backing up your game
- The text parser
- Translations
- Global variables
- Custom Properties
- Plugins
- Lip sync
- New Game templates
- Debugging features
- Auto-number speech files
- Integration with Windows
- Source Control integration
Engine
Scripting
- Scripting tutorial part 1
- Scripting tutorial part 2
- Pointers in AGS
- Calling global functions from local scripts
- The script header
- String formatting
- Multiple Scripts
- Understanding blocking scripts
- Dynamic Arrays
- Extender functions
- Game variables
- Predefined global script functions
- repeatedly_execute (_always)
- Custom dialog options rendering
- Built-in enumerated types
- Script language keywords
- AudioChannel functions and properties
- AudioClip functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game / Global functions
- 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
- Multimedia functions
- Object functions and properties
- Overlay functions and properties
- Palette functions
- Parser functions
- Region functions and properties
- Room functions
- Screen functions
- Speech functions and properties
- String functions
- System functions and properties
- Text display / Speech functions
- ViewFrame functions and properties
Working on Legacy games
Upgrading from a previous version
- Upgrading to AGS 2.7
- Upgrading to AGS 2.71
- Upgrading to AGS 3.0
- Upgrading to AGS 3.1
- Upgrading to AGS 3.2
- Upgrading to AGS 3.3
- Upgrading to AGS 3.3.5
- Upgrading to AGS 3.4
- Upgrading to AGS 3.4.1
Legal Notice
Getting in touch