Add a thin wrapper that directly supports the gviz API. This resolves issue 1.
[dygraphs.git] / mochikit_v14 / doc / rst / MochiKit / DateTime.rst
CommitLineData
6a1aa64f
DV
1.. title:: MochiKit.DateTime - "what time is it anyway?"
2
3Name
4====
5
6MochiKit.DateTime - "what time is it anyway?"
7
8
9Synopsis
10========
11
12::
13
14 stringDate = toISOTimestamp(new Date());
15 dateObject = isoTimestamp(stringDate);
16
17
18Description
19===========
20
21Remote servers don't give you JavaScript Date objects, and they
22certainly don't want them from you, so you need to deal with string
23representations of dates and timestamps. MochiKit.Date does that.
24
25
26Dependencies
27============
28
29None.
30
31
32API Reference
33=============
34
35Functions
36---------
37
38:mochidef:`isoDate(str)`:
39
40 Convert an ISO 8601 date (YYYY-MM-DD) to a ``Date`` object.
41
42 *Availability*:
43 Available in MochiKit 1.3.1+
44
45
46:mochidef:`isoTimestamp(str)`:
47
48 Convert any ISO 8601 [1]_ timestamp (or something reasonably close
49 to it) to a ``Date`` object. Will accept the "de facto" form:
50
51 YYYY-MM-DD hh:mm:ss
52
53 or (the proper form):
54
55 YYYY-MM-DDThh:mm:ssZ
56
57 If a time zone designator ("Z" or "[+-]HH:MM") is not present,
58 then the local timezone is used.
59
60 *Availability*:
61 Available in MochiKit 1.3.1+
62
63
64:mochidef:`toISOTime(date)`:
65
66 Convert a ``Date`` object to a string in the form of hh:mm:ss
67
68 *Availability*:
69 Available in MochiKit 1.3.1+
70
71
72:mochidef:`toISOTimestamp(date, realISO=false)`:
73
74 Convert a ``Date`` object to something that's ALMOST but not quite
75 an ISO 8601 [1]_timestamp. If it was a proper ISO timestamp it
76 would be:
77
78 YYYY-MM-DDThh:mm:ssZ
79
80 However, we see junk in SQL and other places that looks like this:
81
82 YYYY-MM-DD hh:mm:ss
83
84 So, this function returns the latter form, despite its name,
85 unless you pass ``true`` for ``realISO``.
86
87 *Availability*:
88 Available in MochiKit 1.3.1+
89
90
91:mochidef:`toISODate(date)`:
92
93 Convert a ``Date`` object to an ISO 8601 [1]_ date string
94 (YYYY-MM-DD)
95
96 *Availability*:
97 Available in MochiKit 1.3.1+
98
99
100:mochidef:`americanDate(str)`:
101
102 Converts a MM/DD/YYYY date to a ``Date`` object
103
104 *Availability*:
105 Available in MochiKit 1.3.1+
106
107
108:mochidef:`toPaddedAmericanDate(date)`:
109
110 Converts a ``Date`` object to an MM/DD/YYYY date, e.g. 01/01/2001
111
112 *Availability*:
113 Available in MochiKit 1.3.1+
114
115
116:mochidef:`toAmericanDate(date)`:
117
118 Converts a ``Date`` object to an M/D/YYYY date, e.g. 1/1/2001
119
120 *Availability*:
121 Available in MochiKit 1.3.1+
122
123
124See Also
125========
126
127.. [1] W3C profile of ISO 8601: http://www.w3.org/TR/NOTE-datetime
128
129
130Authors
131=======
132
133- Bob Ippolito <bob@redivi.com>
134
135
136Copyright
137=========
138
139Copyright 2005 Bob Ippolito <bob@redivi.com>. This program is
140dual-licensed free software; you can redistribute it and/or modify it
141under the terms of the `MIT License`_ or the `Academic Free License
142v2.1`_.
143
144.. _`MIT License`: http://www.opensource.org/licenses/mit-license.php
145.. _`Academic Free License v2.1`: http://www.opensource.org/licenses/afl-2.1.php