enable grammerly in editor
[roojs1] / docs / symbols / Date.json
1 {
2   "name" : "Date",
3   "augments" : [],
4   "desc" : "The date parsing and format syntax is a subset of\n<a href=\"http://www.php.net/date\">PHP's date() function</a>, and the formats that are\nsupported will provide results equivalent to their PHP versions.\n\nFollowing is the list of all currently supported formats:\n<pre>\nSample date:\n'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'\n\nFormat  Output      Description\n------  ----------  --------------------------------------------------------------\n  d      10         Day of the month, 2 digits with leading zeros\n  D      Wed        A textual representation of a day, three letters\n  j      10         Day of the month without leading zeros\n  l      Wednesday  A full textual representation of the day of the week\n  S      th         English ordinal day of month suffix, 2 chars (use with j)\n  w      3          Numeric representation of the day of the week\n  z      9          The julian date, or day of the year (0-365)\n  W      01         ISO-8601 2-digit week number of year, weeks starting on Monday (00-52)\n  F      January    A full textual representation of the month\n  m      01         Numeric representation of a month, with leading zeros\n  M      Jan        Month name abbreviation, three letters\n  n      1          Numeric representation of a month, without leading zeros\n  t      31         Number of days in the given month\n  L      0          Whether it's a leap year (1 if it is a leap year, else 0)\n  Y      2007       A full numeric representation of a year, 4 digits\n  y      07         A two digit representation of a year\n  a      pm         Lowercase Ante meridiem and Post meridiem\n  A      PM         Uppercase Ante meridiem and Post meridiem\n  g      3          12-hour format of an hour without leading zeros\n  G      15         24-hour format of an hour without leading zeros\n  h      03         12-hour format of an hour with leading zeros\n  H      15         24-hour format of an hour with leading zeros\n  i      05         Minutes with leading zeros\n  s      01         Seconds, with leading zeros\n  O      -0600      Difference to Greenwich time (GMT) in hours (Allows +08, without minutes)\n  P      -06:00     Difference to Greenwich time (GMT) with colon between hours and minutes\n  T      CST        Timezone setting of the machine running the code\n  Z      -21600     Timezone offset in seconds (negative if west of UTC, positive if east)\n</pre>\n\nExample usage (note that you must escape format specifiers with '\\\\' to render them as character literals):\n<pre><code>\nvar dt = new Date('1/10/2007 03:05:01 PM GMT-0600');\ndocument.write(dt.format('Y-m-d'));                         //2007-01-10\ndocument.write(dt.format('F j, Y, g:i a'));                 //January 10, 2007, 3:05 pm\ndocument.write(dt.format('l, \\\\t\\\\he dS of F Y h:i:s A'));  //Wednesday, the 10th of January 2007 03:05:01 PM\n </code></pre>\n\nHere are some standard date/time patterns that you might find helpful.  They\nare not part of the source of Date.js, but to use them you can simply copy this\nblock of code into any script that is included after Date.js and they will also become\nglobally available on the Date object.  Feel free to add or remove patterns as needed in your code.\n<pre><code>\nDate.patterns = {\n    ISO8601Long:\"Y-m-d H:i:s\",\n    ISO8601Short:\"Y-m-d\",\n    ShortDate: \"n/j/Y\",\n    LongDate: \"l, F d, Y\",\n    FullDateTime: \"l, F d, Y g:i:s A\",\n    MonthDay: \"F d\",\n    ShortTime: \"g:i A\",\n    LongTime: \"g:i:s A\",\n    SortableDateTime: \"Y-m-d\\\\TH:i:s\",\n    UniversalSortableDateTime: \"Y-m-d H:i:sO\",\n    YearMonth: \"F, Y\"\n};\n</code></pre>\n\nExample usage:\n<pre><code>\nvar dt = new Date();\ndocument.write(dt.format(Date.patterns.ShortDate));\n </code></pre>",
5   "isSingleton" : false,
6   "isStatic" : false,
7   "isBuiltin" : true,
8   "memberOf" : "Date",
9   "example" : "",
10   "deprecated" : "",
11   "since" : "",
12   "see" : "",
13   "params" : [],
14   "returns" : [],
15   "config" : [],
16   "methods" : [
17     {
18       "name" : "getDayOfYear",
19       "desc" : "Get the numeric day number of the year, adjusted for leap year.",
20       "isStatic" : false,
21       "isConstructor" : false,
22       "isPrivate" : false,
23       "memberOf" : "Date",
24       "example" : "",
25       "deprecated" : "",
26       "since" : "",
27       "see" : "",
28       "params" : [],
29       "returns" : [
30         {
31           "name" : "",
32           "type" : "Number",
33           "desc" : "0 through 364 (365 in leap years)"
34         }
35       ]
36     },
37     {
38       "name" : "getFirstDateOfMonth",
39       "desc" : "Get the first date of this date's month",
40       "isStatic" : false,
41       "isConstructor" : false,
42       "isPrivate" : false,
43       "memberOf" : "Date",
44       "example" : "",
45       "deprecated" : "",
46       "since" : "",
47       "see" : "",
48       "params" : [],
49       "returns" : [
50         {
51           "name" : "",
52           "type" : "Date",
53           "desc" : ""
54         }
55       ]
56     },
57     {
58       "name" : "format",
59       "desc" : "Formats a date given the supplied format string",
60       "isStatic" : false,
61       "isConstructor" : false,
62       "isPrivate" : false,
63       "memberOf" : "Date",
64       "example" : "",
65       "deprecated" : "",
66       "since" : "",
67       "see" : "",
68       "params" : [
69         {
70           "name" : "format",
71           "type" : "String",
72           "desc" : "The format string",
73           "isOptional" : false
74         }
75       ],
76       "returns" : [
77         {
78           "name" : "",
79           "type" : "String",
80           "desc" : "The formatted date"
81         }
82       ]
83     },
84     {
85       "name" : "clearTime",
86       "desc" : "Clears any time information from this date",
87       "isStatic" : false,
88       "isConstructor" : false,
89       "isPrivate" : false,
90       "memberOf" : "Date",
91       "example" : "",
92       "deprecated" : "",
93       "since" : "",
94       "see" : "",
95       "params" : [
96         {
97           "name" : "clone",
98           "type" : "Boolean",
99           "desc" : "true to create a clone of this date, clear the time and return it",
100           "isOptional" : false
101         }
102       ],
103       "returns" : [
104         {
105           "name" : "",
106           "type" : "Date",
107           "desc" : "this or the clone"
108         }
109       ]
110     },
111     {
112       "name" : "getGMTColonOffset",
113       "desc" : "Get the offset from GMT of the current date (equivalent to the format specifier 'P').",
114       "isStatic" : false,
115       "isConstructor" : false,
116       "isPrivate" : false,
117       "memberOf" : "Date",
118       "example" : "",
119       "deprecated" : "",
120       "since" : "",
121       "see" : "",
122       "params" : [],
123       "returns" : [
124         {
125           "name" : "",
126           "type" : "String",
127           "desc" : "2-characters representing hours and 2-characters representing minutes\nseperated by a colon and prefixed with + or - (e.g. '-06:00')"
128         }
129       ]
130     },
131     {
132       "name" : "getLastDateOfMonth",
133       "desc" : "Get the last date of this date's month",
134       "isStatic" : false,
135       "isConstructor" : false,
136       "isPrivate" : false,
137       "memberOf" : "Date",
138       "example" : "",
139       "deprecated" : "",
140       "since" : "",
141       "see" : "",
142       "params" : [],
143       "returns" : [
144         {
145           "name" : "",
146           "type" : "Date",
147           "desc" : ""
148         }
149       ]
150     },
151     {
152       "name" : "getTimezone",
153       "desc" : "Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').",
154       "isStatic" : false,
155       "isConstructor" : false,
156       "isPrivate" : false,
157       "memberOf" : "Date",
158       "example" : "",
159       "deprecated" : "",
160       "since" : "",
161       "see" : "",
162       "params" : [],
163       "returns" : [
164         {
165           "name" : "",
166           "type" : "String",
167           "desc" : "The abbreviated timezone name (e.g. 'CST')"
168         }
169       ]
170     },
171     {
172       "name" : "getElapsed",
173       "desc" : "Returns the number of milliseconds between this date and date",
174       "isStatic" : false,
175       "isConstructor" : false,
176       "isPrivate" : false,
177       "memberOf" : "Date",
178       "example" : "",
179       "deprecated" : "",
180       "since" : "",
181       "see" : "",
182       "params" : [
183         {
184           "name" : "date",
185           "type" : "Date",
186           "desc" : "(optional) Defaults to now",
187           "isOptional" : false
188         }
189       ],
190       "returns" : [
191         {
192           "name" : "",
193           "type" : "Number",
194           "desc" : "The diff in milliseconds"
195         }
196       ]
197     },
198     {
199       "name" : "add",
200       "desc" : "Provides a convenient method of performing basic date arithmetic.  This method\ndoes not modify the Date instance being called - it creates and returns\na new Date instance containing the resulting date value.\n\nExamples:\n<pre><code>\n//Basic usage:\nvar dt = new Date('10/29/2006').add(Date.DAY, 5);\ndocument.write(dt); //returns 'Fri Oct 06 2006 00:00:00'\n\n//Negative values will subtract correctly:\nvar dt2 = new Date('10/1/2006').add(Date.DAY, -5);\ndocument.write(dt2); //returns 'Tue Sep 26 2006 00:00:00'\n\n//You can even chain several calls together in one line!\nvar dt3 = new Date('10/1/2006').add(Date.DAY, 5).add(Date.HOUR, 8).add(Date.MINUTE, -30);\ndocument.write(dt3); //returns 'Fri Oct 06 2006 07:30:00'\n </code></pre>",
201       "isStatic" : false,
202       "isConstructor" : false,
203       "isPrivate" : false,
204       "memberOf" : "Date",
205       "example" : "",
206       "deprecated" : "",
207       "since" : "",
208       "see" : "",
209       "params" : [
210         {
211           "name" : "interval",
212           "type" : "String",
213           "desc" : "A valid date interval enum value",
214           "isOptional" : false
215         },
216         {
217           "name" : "value",
218           "type" : "Number",
219           "desc" : "The amount to add to the current date",
220           "isOptional" : false
221         }
222       ],
223       "returns" : [
224         {
225           "name" : "",
226           "type" : "Date",
227           "desc" : "The new Date instance"
228         }
229       ]
230     },
231     {
232       "name" : "getSuffix",
233       "desc" : "Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').",
234       "isStatic" : false,
235       "isConstructor" : false,
236       "isPrivate" : false,
237       "memberOf" : "Date",
238       "example" : "",
239       "deprecated" : "",
240       "since" : "",
241       "see" : "",
242       "params" : [],
243       "returns" : [
244         {
245           "name" : "",
246           "type" : "String",
247           "desc" : "'st, 'nd', 'rd' or 'th'"
248         }
249       ]
250     },
251     {
252       "name" : "getFirstDayOfMonth",
253       "desc" : "Get the first day of the current month, adjusted for leap year.  The returned value\nis the numeric day index within the week (0-6) which can be used in conjunction with\nthe {@link #monthNames} array to retrieve the textual day name.\nExample:\n<pre><code>\nvar dt = new Date('1/10/2007');\ndocument.write(Date.dayNames[dt.getFirstDayOfMonth()]); //output: 'Monday'\n</code></pre>",
254       "isStatic" : false,
255       "isConstructor" : false,
256       "isPrivate" : false,
257       "memberOf" : "Date",
258       "example" : "",
259       "deprecated" : "",
260       "since" : "",
261       "see" : "",
262       "params" : [],
263       "returns" : [
264         {
265           "name" : "",
266           "type" : "Number",
267           "desc" : "The day number (0-6)"
268         }
269       ]
270     },
271     {
272       "name" : "getGMTOffset",
273       "desc" : "Get the offset from GMT of the current date (equivalent to the format specifier 'O').",
274       "isStatic" : false,
275       "isConstructor" : false,
276       "isPrivate" : false,
277       "memberOf" : "Date",
278       "example" : "",
279       "deprecated" : "",
280       "since" : "",
281       "see" : "",
282       "params" : [],
283       "returns" : [
284         {
285           "name" : "",
286           "type" : "String",
287           "desc" : "The 4-character offset string prefixed with + or - (e.g. '-0600')"
288         }
289       ]
290     },
291     {
292       "name" : "getDaysInMonth",
293       "desc" : "Get the number of days in the current month, adjusted for leap year.",
294       "isStatic" : false,
295       "isConstructor" : false,
296       "isPrivate" : false,
297       "memberOf" : "Date",
298       "example" : "",
299       "deprecated" : "",
300       "since" : "",
301       "see" : "",
302       "params" : [],
303       "returns" : [
304         {
305           "name" : "",
306           "type" : "Number",
307           "desc" : "The number of days in the month"
308         }
309       ]
310     },
311     {
312       "name" : "clone",
313       "desc" : "Creates and returns a new Date instance with the exact same date value as the called instance.\nDates are copied and passed by reference, so if a copied date variable is modified later, the original\nvariable will also be changed.  When the intention is to create a new variable that will not\nmodify the original instance, you should create a clone.\n\nExample of correctly cloning a date:\n<pre><code>\n//wrong way:\nvar orig = new Date('10/1/2006');\nvar copy = orig;\ncopy.setDate(5);\ndocument.write(orig);  //returns 'Thu Oct 05 2006'!\n\n//correct way:\nvar orig = new Date('10/1/2006');\nvar copy = orig.clone();\ncopy.setDate(5);\ndocument.write(orig);  //returns 'Thu Oct 01 2006'\n</code></pre>",
314       "isStatic" : false,
315       "isConstructor" : false,
316       "isPrivate" : false,
317       "memberOf" : "Date",
318       "example" : "",
319       "deprecated" : "",
320       "since" : "",
321       "see" : "",
322       "params" : [],
323       "returns" : [
324         {
325           "name" : "",
326           "type" : "Date",
327           "desc" : "The new Date instance"
328         }
329       ]
330     },
331     {
332       "name" : "getWeekOfYear",
333       "desc" : "Get the string representation of the numeric week number of the year\n(equivalent to the format specifier 'W').",
334       "isStatic" : false,
335       "isConstructor" : false,
336       "isPrivate" : false,
337       "memberOf" : "Date",
338       "example" : "",
339       "deprecated" : "",
340       "since" : "",
341       "see" : "",
342       "params" : [],
343       "returns" : [
344         {
345           "name" : "",
346           "type" : "String",
347           "desc" : "'00' through '52'"
348         }
349       ]
350     },
351     {
352       "name" : "isLeapYear",
353       "desc" : "Whether or not the current date is in a leap year.",
354       "isStatic" : false,
355       "isConstructor" : false,
356       "isPrivate" : false,
357       "memberOf" : "Date",
358       "example" : "",
359       "deprecated" : "",
360       "since" : "",
361       "see" : "",
362       "params" : [],
363       "returns" : [
364         {
365           "name" : "",
366           "type" : "Boolean",
367           "desc" : "True if the current date is in a leap year, else false"
368         }
369       ]
370     },
371     {
372       "name" : "getLastDayOfMonth",
373       "desc" : "Get the last day of the current month, adjusted for leap year.  The returned value\nis the numeric day index within the week (0-6) which can be used in conjunction with\nthe {@link #monthNames} array to retrieve the textual day name.\nExample:\n<pre><code>\nvar dt = new Date('1/10/2007');\ndocument.write(Date.dayNames[dt.getLastDayOfMonth()]); //output: 'Wednesday'\n</code></pre>",
374       "isStatic" : false,
375       "isConstructor" : false,
376       "isPrivate" : false,
377       "memberOf" : "Date",
378       "example" : "",
379       "deprecated" : "",
380       "since" : "",
381       "see" : "",
382       "params" : [],
383       "returns" : [
384         {
385           "name" : "",
386           "type" : "Number",
387           "desc" : "The day number (0-6)"
388         }
389       ]
390     },
391     {
392       "name" : "parseDate",
393       "desc" : "Parses the passed string using the specified format. Note that this function expects dates in normal calendar\nformat, meaning that months are 1-based (1 = January) and not zero-based like in JavaScript dates.  Any part of\nthe date format that is not specified will default to the current date value for that part.  Time parts can also\nbe specified, but default to 0.  Keep in mind that the input date string must precisely match the specified format\nstring or the parse operation will fail.\nExample Usage:\n<pre><code>\n//dt = Fri May 25 2007 (current date)\nvar dt = new Date();\n\n//dt = Thu May 25 2006 (today's month/day in 2006)\ndt = Date.parseDate(\"2006\", \"Y\");\n\n//dt = Sun Jan 15 2006 (all date parts specified)\ndt = Date.parseDate(\"2006-1-15\", \"Y-m-d\");\n\n//dt = Sun Jan 15 2006 15:20:01 GMT-0600 (CST)\ndt = Date.parseDate(\"2006-1-15 3:20:01 PM\", \"Y-m-d h:i:s A\" );\n</code></pre>",
394       "isStatic" : true,
395       "isConstructor" : false,
396       "isPrivate" : false,
397       "memberOf" : "Date",
398       "example" : "",
399       "deprecated" : "",
400       "since" : "",
401       "see" : "",
402       "params" : [
403         {
404           "name" : "input",
405           "type" : "String",
406           "desc" : "The unparsed date as a string",
407           "isOptional" : false
408         },
409         {
410           "name" : "format",
411           "type" : "String",
412           "desc" : "The format the date is in",
413           "isOptional" : false
414         }
415       ],
416       "returns" : [
417         {
418           "name" : "",
419           "type" : "Date",
420           "desc" : "The parsed date"
421         }
422       ]
423     }
424   ],
425   "events" : []
426 }