-
Notifications
You must be signed in to change notification settings - Fork 0
/
jodatime-about.html
executable file
·317 lines (296 loc) · 19 KB
/
jodatime-about.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia Site Renderer 1.3 at May 19, 2012 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>op4j: bending the Java spoon - JodaTime Extension</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta name="Date-Revision-yyyymmdd" content="20120519" />
<meta http-equiv="Content-Language" content="en" />
</head>
<body class="composite">
<div id="banner">
<a href="./" id="bannerLeft">
<img src="images/op4j_logo.png" alt="op4j: bending the Java spoon" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 19 May 2012</span>
| <span id="projectVersion">Version: 1.2</span>
</div>
<div class="xright"> <a href="index.html" title="Main">Main</a>
|
<a href="download.html" title="Download">Download</a>
|
<a href="https://www.bendingthejavaspoon.com" class="externalLink" title="Example Recipes Blog">Example Recipes Blog</a>
|
<a href="https://github.com/op4j/op4j.github.com/issues" class="externalLink" title="Issue Tracking">Issue Tracking</a>
|
<a href="apidocs/index.html" title="Javadoc">Javadoc</a>
|
<a href="https://github.com/op4j" class="externalLink" title="Github Project Page">Github Project Page</a>
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>The op4j Project</h5>
<ul>
<li class="none">
<a href="index.html" title="· Main">· Main</a>
</li>
<li class="none">
<a href="download.html" title="· Download">· Download</a>
</li>
<li class="none">
<a href="maveninfo.html" title="· Maven Info">· Maven Info</a>
</li>
<li class="none">
<a href="dependencies.html" title="· Dependencies">· Dependencies</a>
</li>
<li class="none">
<a href="https://github.com/op4j" class="externalLink" title="· Github Repository">· Github Repository</a>
</li>
<li class="none">
<a href="https://www.bendingthejavaspoon.com" class="externalLink" title="· Example Recipes">· Example Recipes</a>
</li>
<li class="none">
<a href="https://github.com/op4j/op4j.github.com/issues" class="externalLink" title="· Issue Tracking">· Issue Tracking</a>
</li>
<li class="expanded">
<a href="#" title="· Documentation">· Documentation</a>
<ul>
<li class="none">
<a href="basics.html" title="· The Basics">· The Basics</a>
</li>
<li class="expanded">
<a href="#" title="· Working with...">· Working with...</a>
<ul>
<li class="none">
<a href="arrays.html" title="· Arrays">· Arrays</a>
</li>
<li class="none">
<a href="lists.html" title="· Lists">· Lists</a>
</li>
<li class="none">
<a href="maps.html" title="· Maps">· Maps</a>
</li>
<li class="none">
<a href="sets.html" title="· Sets">· Sets</a>
</li>
<li class="none">
<a href="generic.html" title="· Any object (generic)">· Any object (generic)</a>
</li>
</ul>
</li>
<li class="expanded">
<a href="#" title="· Functions">· Functions</a>
<ul>
<li class="none">
<a href="functions.html" title="· About Functions">· About Functions</a>
</li>
<li class="none">
<a href="call.html" title="· Call">· Call</a>
</li>
<li class="none">
<a href="get.html" title="· Get">· Get</a>
</li>
<li class="none">
<a href="fnfunc.html" title="· FnFunc">· FnFunc</a>
</li>
<li class="none">
<a href="fnboolean.html" title="· FnBoolean">· FnBoolean</a>
</li>
<li class="none">
<a href="fncalendar.html" title="· FnCalendar">· FnCalendar</a>
</li>
<li class="none">
<a href="fndate.html" title="· FnDate">· FnDate</a>
</li>
<li class="none">
<a href="fnobject.html" title="· FnObject">· FnObject</a>
</li>
<li class="none">
<a href="fnstring.html" title="· FnString">· FnString</a>
</li>
<li class="expanded">
<a href="#" title="· Numbers">· Numbers</a>
<ul>
<li class="none">
<a href="fnnumber.html" title="· FnNumber">· FnNumber</a>
</li>
<li class="none">
<a href="fnbigdecimal.html" title="· FnBigDecimal">· FnBigDecimal</a>
</li>
<li class="none">
<a href="fnbiginteger.html" title="· FnBigInteger">· FnBigInteger</a>
</li>
<li class="none">
<a href="fninteger.html" title="· FnInteger">· FnInteger</a>
</li>
<li class="none">
<a href="fnlong.html" title="· FnLong">· FnLong</a>
</li>
<li class="none">
<a href="fnfloat.html" title="· FnFloat">· FnFloat</a>
</li>
<li class="none">
<a href="fndouble.html" title="· FnDouble">· FnDouble</a>
</li>
<li class="none">
<a href="fndouble.html" title="· FnShort">· FnShort</a>
</li>
</ul>
</li>
<li class="expanded">
<a href="#" title="· Structures">· Structures</a>
<ul>
<li class="none">
<a href="fnarray.html" title="· FnArray">· FnArray</a>
</li>
<li class="none">
<a href="fnlist.html" title="· FnList">· FnList</a>
</li>
<li class="none">
<a href="fnmap.html" title="· FnMap">· FnMap</a>
</li>
<li class="none">
<a href="fnset.html" title="· FnSet">· FnSet</a>
</li>
<li class="none">
<a href="fntuple.html" title="· FnTuple">· FnTuple</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="none">
<a href="apidocs/op4j/index.html" title="· Javadoc">· Javadoc</a>
</li>
<li class="none">
<a href="faq.html" title="· FAQ">· FAQ</a>
</li>
</ul>
</li>
<li class="none">
<a href="license.html" title="· License">· License</a>
</li>
<li class="none">
<a href="team.html" title="· Team">· Team</a>
</li>
</ul>
<ul>
<li class="collapsed">
<a href="ognl-about.html" title="· op4j-ognl">· op4j-ognl</a>
</li>
<li class="expanded">
<strong>· op4j-jodatime</strong>
<ul>
<li class="expanded">
<a href="#" title="· Functions">· Functions</a>
<ul>
<li class="none">
<a href="jodatime-fndatemidnight.html" title="· FnDateMidnight">· FnDateMidnight</a>
</li>
<li class="none">
<a href="jodatime-fndatetime.html" title="· FnDateTime">· FnDateTime</a>
</li>
<li class="none">
<a href="jodatime-fninterval.html" title="· FnInterval">· FnInterval</a>
</li>
<li class="none">
<a href="jodatime-fnjodastring.html" title="· FnJodaString">· FnJodaString</a>
</li>
<li class="none">
<a href="jodatime-fnlocaldate.html" title="· FnLocalDate">· FnLocalDate</a>
</li>
<li class="none">
<a href="jodatime-fnlocaltime.html" title="· FnLocalTime">· FnLocalTime</a>
</li>
<li class="none">
<a href="jodatime-fnmutabledatetime.html" title="· FnMutableDateTime">· FnMutableDateTime</a>
</li>
<li class="none">
<a href="jodatime-fnperiod.html" title="· FnPeriod">· FnPeriod</a>
</li>
</ul>
</li>
<li class="none">
<a href="apidocs/op4j-jodatime/index.html" title="· Javadoc">· Javadoc</a>
</li>
</ul>
</li>
</ul>
<a href="https://maven.apache.org" title="Built with Maven 2" class="poweredBy">
<img class="poweredBy" alt="Built with Maven 2" src="https://maven.apache.org/images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section"><h2>JodaTime Extension<a name="JodaTime_Extension"></a></h2><p><a class="externalLink" href="http://joda-time.sourceforge.net/">Joda-Time</a>, as said in its website, <i>"provides a quality replacement for the Java date and time classes"</i>. It contains lots of classes to work with dates, times, timezones and an integration with Hibernate among other functionalities.</p><p><b>op4j-jodatime</b> is an extension that gives you access to a bunch of functions related to jodatime classes in an op4j way. The functions in this extension include:</p><ul><li>Conversions from BaseDateTime to String</li><li>Conversions from Calendar to DateTime</li><li>Conversions from Date to DateMidnight</li><li>Creation of Period from Calendar objects</li><li>Creation of Interval from String objects</li><li>... and many more</li></ul><div class="section"><h3>Function classes<a name="Function_classes"></a></h3><p>The extension comprises the following <i>function hub class</i>:</p><ul><li><a href="./jodatime-fnjodastring.html">FnJodaString</a>: contains functions related to the conversion from several input types into String</li><li><a href="./jodatime-fndatemidnight.html">FnDateMidnight</a>: functions related to the conversion into DateMidnight</li><li><a href="./jodatime-fndatetime.html">FnDateTime</a>: functions related to the conversion to FnDateTime</li><li><a href="./jodatime-fnmutabledatetime.html">FnMutableDateTime</a>: functions returning a MutableDateTime as its output</li><li><a href="./jodatime-fninterval.html">FnInterval</a>: contains functions returning an Interval as its output</li><li><a href="./jodatime-fnlocaldate.html">FnLocalDate</a>: deals with the conversion from several input types into LocalDate</li><li><a href="./jodatime-fnlocaltime.html">FnLocalTime</a>: its functions generate a LocalTime as its output</li><li><a href="./jodatime-fnperiod.html">FnPeriod</a>: contains a set of functions whose output is Period</li><li>FnJodaTimeUtils: is a shortcut to all of the methods included in the classes above. This way, </li></ul><div class="source"><pre>List<DateTime> targets = new ArrayList<DateTime>();
targets.add(new DateTime());
List<String> result1 = Op.onList(targets).forEach().exec(FnJodaString.baseDateTimeToStr(FormatType.PATTERN,
"yyyy-MM-DD_HH:mm:ss:SS")).get();
String pattern = "dd/mm/yyyy-HH:mm";
String asStr = "24/12/2000-15:03";
DateMidnight result2 = Op.on(asStr).exec(FnDateMidnight.strToDateMidnight(pattern)).get();
</pre></div><p>is equivalent to</p><div class="source"><pre>List<DateTime> targets = new ArrayList<DateTime>();
targets.add(new DateTime());
List<String> result1 = Op.onList(targets).forEach().exec(FnJodaTimeUtils.baseDateTimeToStr(FormatType.PATTERN,
"yyyy-MM-DD_HH:mm:ss:SS")).get();
String pattern = "dd/mm/yyyy-HH:mm";
String asStr = "24/12/2000-15:03";
DateMidnight result2 = Op.on(asStr).exec(FnJodaTimeUtils.strToDateMidnight(pattern)).get();
</pre></div></div><div class="section"><h3>Use<a name="Use"></a></h3><p>This section includes some examples of the use of the classes listed above. To learn about the methods available, visit the pages:</p><ul><li><a href="./jodatime-fnjodastring.html">FnJodaString</a> </li><li><a href="./jodatime-fndatemidnight.html">FnDateMidnight</a> </li><li><a href="./jodatime-fndatetime.html">FnDateTime</a> </li><li><a href="./jodatime-fnmutabledatetime.html">FnMutableDateTime</a> </li><li><a href="./jodatime-fninterval.html">FnInterval</a> </li><li><a href="./jodatime-fnlocaldate.html">FnLocalDate</a> </li><li><a href="./jodatime-fnlocaltime.html">FnLocalTime</a> </li><li><a href="./jodatime-fnperiod.html">FnPeriod</a> </li></ul><div class="source"><pre>
List<DateMidnight> targets = new ArrayList<DateMidnight>();
targets.add(new DateMidnight());
List<String> result = Op.onList(targets).forEach().exec(FnJodaString
.baseDateTimeToStr(FormatType.STYLE, "MM", Locale.UK.toString())).get();
/* *** */
Timestamp timestamp = new Timestamp(new Date().getTime());
LocalTime result = Op.on(timestamp).exec(FnLocalTime.timestampToLocalTime(
DateTimeZone.getDefault())).get();
/* *** */
Interval result = Op.on(Arrays.asList("1977", "5", "2", "23", "12", "2", "34",
"1980", "8", "5", "12", "12", "12", "4"))
.exec(FnInterval.strFieldCollectionToInterval(DateTimeZone.getDefault()))
.get();
/* *** */
Interval result = Op.on(Arrays.asList("2000/02/09", "2001/09/05"))
.exec(FnInterval.strFieldCollectionToInterval("yyyy/mm/dd", DateTimeZone.getDefault())).get();
/* *** */
Long start = Long.valueOf(1000);
Long end = Long.valueOf(1000000);
Interval result = Op.on(new Long[] {start, end})
.exec(FnInterval.longFieldArrayToInterval(GJChronology.getInstance()))
.get();
</pre></div></div></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright © 2012
<a href="https://www.op4j.org">The OP4J team</a>.
All Rights Reserved.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>