Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

DateTime class: Difference between revisions

From Catglobe Wiki
Nguyenduyan (talk | contribs)
No edit summary
Nguyenduyan (talk | contribs)
No edit summary
Line 28: Line 28:
print(dt.AsArray);//{2017,10,2,4,13,34,583,40,0}
print(dt.AsArray);//{2017,10,2,4,13,34,583,40,0}
//*Ex2
//*Ex2
DateTime dt = new DateTime("2009/04/05");
DateTime dt = new DateTime("2009/4/5");
print(dt.ToString());//2009-04-05 00:00:00
print(dt.ToString());//2009-04-05 00:00:00
print(dt.AsArray);//{2009,4,5,0,0,0,0,14,0}
//*Ex3
//*Ex3
DateTime dt = new DateTime("2017/02/14");
print(dt.AsArray);//{2017,2,14,0,0,0,0,7}
//*Ex4
DateTime dt = new DateTime({2017,10,2,4,13,34,583,40,0});
DateTime dt = new DateTime({2017,10,2,4,13,34,583,40,0});
print(dt.ToString());//2017-10-02 04:13:34
print(dt.ToString());//2017-10-02 04:13:34

Revision as of 04:33, 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

//*Ex1
DateTime dt = new DateTime ();
print(dt.AsArray);//{2017,10,2,4,13,34,583,40,0}
//*Ex2
DateTime dt = new DateTime("2009/4/5");
print(dt.ToString());//2009-04-05 00:00:00
print(dt.AsArray);//{2009,4,5,0,0,0,0,14,0}
//*Ex3
DateTime dt = new DateTime({2017,10,2,4,13,34,583,40,0});
print(dt.ToString());//2017-10-02 04:13:34
print(dt.AsUnixtimeMillisecondsSince1970());//1506917614583
print(dt.AsUnixtimeSecondsSince1970());//1506917614