Difference between revisions of "DateTime parse"

From Catglobe Wiki
Jump to: navigation, search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:General_Functions]]
 
[[Category:General_Functions]]

 
  
====DateTime_parse====
+
=DateTime_parse=
  
 
Return datetime after parsing
 
Return datetime after parsing
  
'''Syntax'''
+
===Syntax===
  
 
DateTime_parse(rawDatetime, format);
 
DateTime_parse(rawDatetime, format);
  
'''Arguments'''
+
===Arguments===
  
 
* rawDatetime: is string
 
* rawDatetime: is string
 
* format: is string
 
* format: is string
  
'''Return value'''
+
===Return value===
  
array, in which there are 9 items:
+
An array, in which there are 9 items:
  
 
{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="876" border="1" cellpadding="2"
 
{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="876" border="1" cellpadding="2"
Line 90: Line 89:
 
| style="border: 1px solid #010101" width="558" |
 
| style="border: 1px solid #010101" width="558" |
 
Login user's timezone
 
Login user's timezone
 +
|}
  
'''Example'''
+
=== Example ===
  
DateTime_parse(“2009/4/5”,”yyyy/MM/dd”); print(a);
+
''array a = DateTime_parse("2009/4/5","yyyy/MM/dd"); ''
  
// or
+
''print(a); //Result: {2009,4,5,0,0,0,0,14,65}''
  
array a = DateTime_parse(“2009/4/5 0:0:0”,”yyyy/MM/dd hh:mm:ss”); print(a);
+
''array b = DateTime_parse("2009/4/5 5:10:24","yyyy/MM/dd hh:mm:ss"); ''
  
// or
+
''print(b); //Result: {2009,4,5,5,10,24,0,14,65}''
  
array a = DateTime_parse(“2009/4/5 0:0:0”,”yyyy/MM/dd”); print(a);
+
''array c = DateTime_parse("2009-4-5 23:59:59","yyyy-MM-dd"); ''
  
// or
+
''print(c); //Result: {2009,4,5,23,59,59,0,14,65}''
  
array a = DateTime_parse(“2009/4/5”,”yyyy/MM/dd hh:mm:ss”); print(a);
+
''array d = DateTime_parse("2009/4/5","yyyy/MM/dd hh:mm:ss"); ''
  
//Repeat with seperator char -
+
''print(d); //Result: {2009,4,5,0,0,0,0,14,65}''
  
'''Availability'''
 
 
Version 5.7
 
 
__NOTOC__
 
__NOTOC__
<!-- imported from file: 7546.htm-->
 

Latest revision as of 11:22, 21 December 2011


DateTime_parse

Return datetime after parsing

Syntax

DateTime_parse(rawDatetime, format);

Arguments

  • rawDatetime: is string
  • format: is string

Return value

An array, in which there are 9 items:

Index

Data type

Value

DateTime_Year

number

Value parsed from date time string

DateTime_Month

number

Value parsed from date time string

DateTime_Day

number

Value parsed from date time string

DateTime_Hour

number

Value parsed from date time string) (0 if date time string doesn't have it)

DateTime_Minute

number

Value parsed from date time string) (0 if date time string doesn't have it)

DateTime_Second

number

Value parsed from date time string) (0 if date time string doesn't have it)

DateTime_Millisecond

number

default 0

DateTime_Week

number

Depend on year, day, month

DateTime_TimeZone

number

Login user's timezone

Example

array a = DateTime_parse("2009/4/5","yyyy/MM/dd");

print(a); //Result: {2009,4,5,0,0,0,0,14,65}

array b = DateTime_parse("2009/4/5 5:10:24","yyyy/MM/dd hh:mm:ss");

print(b); //Result: {2009,4,5,5,10,24,0,14,65}

array c = DateTime_parse("2009-4-5 23:59:59","yyyy-MM-dd");

print(c); //Result: {2009,4,5,23,59,59,0,14,65}

array d = DateTime_parse("2009/4/5","yyyy/MM/dd hh:mm:ss");

print(d); //Result: {2009,4,5,0,0,0,0,14,65}