Difference between revisions of "DateTime class"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=DateTime
+
|Name=<nowiki>DateTime</nowiki>
|Description=The DateTime object
+
|Description=<nowiki>The DateTime object</nowiki>
 
|Constructors=
 
|Constructors=
 +
{{CGscriptConstructors_Template|Description=<nowiki>Now in UTC timezone</nowiki>}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=string|Name=value|Description=Value to parse as a date, syntax is same as for constant values}}
+
{{CGscriptParameters_Template|Type=string|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to parse as a date, syntax is same as for constant values</nowiki>}}
|Description=New based on a string representation of a date}}
+
|Description=<nowiki>New based on a string representation of a date</nowiki>}}
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=array|Name=value|Description=Value to parse as a date}}
+
{{CGscriptParameters_Template|Type=array|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to parse as a date</nowiki>}}
|Description=New based on a array representation of a date}}
+
|Description=<nowiki>New based on a array representation of a date</nowiki>}}
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
+
{{CGscriptMethods_Template|ReturnType=number|Name=<nowiki>AsUnixtimeMillisecondsSince1970</nowiki>|Description=<nowiki>Return value as number of milliseconds since 1 / 1 1970</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=number|Name=<nowiki>AsUnixtimeSecondsSince1970</nowiki>|Description=<nowiki>Return value as number of seconds since 1/1 1970</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
{{CGscriptProperties_Template|ReturnType=array|Name=AsArray|HasGetter=1|Description=Return value as the array representation of a date}}
+
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>AsArray</nowiki>|HasGetter=1|Description=<nowiki>Return value as the array representation of a date</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 +
  
 
==== <span style="color:#a52a2a">'''Examples'''</span> ====
 
==== <span style="color:#a52a2a">'''Examples'''</span> ====

Revision as of 06:10, 2 October 2017

DateTime



The DateTime object

Constructors

  • () - Now in UTC timezone
  • (string value "Value to parse as a date, syntax is same as for constant values") - New based on a string representation of a date
  • (array value "Value to parse as a date") - New based on a array representation of a date

Methods

  • number AsUnixtimeMillisecondsSince1970() - Return value as number of milliseconds since 1 / 1 1970
  • number AsUnixtimeSecondsSince1970() - Return value as number of seconds since 1/1 1970
  • string ToString() - The string representation of the object.

Properties

  • array AsArray { get; } - Return value as the array representation of a date
  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

DateTime dt = new DateTime("2009/04/05");
print(dt.ToString());


DateTime dt = new DateTime("2017/02/14");
print(dt.AsArray);//{2017,2,14,0,0,0,0,7}