|
@@ -144,7 +144,7 @@ |
144 |
144 |
|
|
145 |
145 |
|
public static java.sql.Date to_SqlDate( SimpleDate pDate ) |
146 |
146 |
|
{ |
147 |
|
- |
return new java.sql.Date( pDate.getDate().getTime() ); |
|
147 |
+ |
return new java.sql.Date( pDate.toUtilDate().getTime() ); |
148 |
148 |
|
} |
149 |
149 |
|
|
150 |
150 |
|
public static Date to_UtilDate( Object pObject ) |
|
@@ -163,7 +163,7 @@ |
163 |
163 |
|
} |
164 |
164 |
|
if ( pObject instanceof SimpleDate ) |
165 |
165 |
|
{ |
166 |
|
- |
return ((SimpleDate) pObject).getDate(); |
|
166 |
+ |
return ((SimpleDate) pObject).toUtilDate(); |
167 |
167 |
|
} |
168 |
168 |
|
if ( pObject instanceof SimpleTimestamp ) |
169 |
169 |
|
{ |
|
@@ -184,7 +184,7 @@ |
184 |
184 |
|
} |
185 |
185 |
|
try |
186 |
186 |
|
{ |
187 |
|
- |
return UtilDateAdaptor.fromDateToString( s ).getDate(); |
|
187 |
+ |
return UtilDateAdaptor.fromUtilDateToString( s ).getWallDate(); |
188 |
188 |
|
} |
189 |
189 |
|
catch ( IllegalArgumentException e ) |
190 |
190 |
|
{ |
|
@@ -350,73 +350,76 @@ |
350 |
350 |
|
{ |
351 |
351 |
|
return null; |
352 |
352 |
|
} |
353 |
|
- |
if ( pObject instanceof SimpleDate ) |
354 |
|
- |
{ |
355 |
|
- |
SimpleDate temporal = (SimpleDate) pObject; |
356 |
|
- |
if ( temporal.getFormat().equals( pFormat ) ) |
357 |
|
- |
{ |
358 |
|
- |
return temporal; |
359 |
|
- |
} |
360 |
|
- |
// Fall thru to 'toString' version... |
361 |
|
- |
} |
|
353 |
+ |
// TODO: XXX |
|
354 |
+ |
// if ( pObject instanceof SimpleDate ) |
|
355 |
+ |
// { |
|
356 |
+ |
// SimpleDate temporal = (SimpleDate) pObject; |
|
357 |
+ |
// if ( temporal.getFormat().equals( pFormat ) ) |
|
358 |
+ |
// { |
|
359 |
+ |
// return temporal; |
|
360 |
+ |
// } |
|
361 |
+ |
// // Fall thru to 'toString' version... |
|
362 |
+ |
// } |
362 |
363 |
|
if ( pObject instanceof Time ) |
363 |
364 |
|
{ |
364 |
365 |
|
throw new IllegalArgumentException( "No convertion supported from SQL Time to Simple Date" ); |
365 |
366 |
|
} |
366 |
|
- |
if ( pObject instanceof Date ) |
367 |
|
- |
{ |
368 |
|
- |
return new SimpleDate( pFormat, (Date) pObject ); |
369 |
|
- |
} |
370 |
|
- |
if ( pObject instanceof Number ) |
371 |
|
- |
{ |
372 |
|
- |
return new SimpleDate( pFormat, new Date( ((Number) pObject).longValue() ) ); |
373 |
|
- |
} |
374 |
|
- |
if ( pObject instanceof SimpleTimestamp ) |
375 |
|
- |
{ |
376 |
|
- |
return new SimpleDate( pFormat, ((SimpleTimestamp) pObject).getDate() ); |
377 |
|
- |
} |
|
367 |
+ |
// TODO: XXX |
|
368 |
+ |
// if ( pObject instanceof Date ) |
|
369 |
+ |
// { |
|
370 |
+ |
// return new SimpleDate( pFormat, (Date) pObject ); |
|
371 |
+ |
// } |
|
372 |
+ |
// if ( pObject instanceof Number ) |
|
373 |
+ |
// { |
|
374 |
+ |
// return new SimpleDate( pFormat, new Date( ((Number) pObject).longValue() ) ); |
|
375 |
+ |
// } |
|
376 |
+ |
// if ( pObject instanceof SimpleTimestamp ) |
|
377 |
+ |
// { |
|
378 |
+ |
// return new SimpleDate( pFormat, ((SimpleTimestamp) pObject).getDate() ); |
|
379 |
+ |
// } |
378 |
380 |
|
String s = pObject.toString(); |
379 |
|
- |
try |
380 |
|
- |
{ |
381 |
|
- |
return new SimpleDate( pFormat, new Date( Long.parseLong( s ) ) ); |
382 |
|
- |
} |
383 |
|
- |
catch ( NumberFormatException e ) |
384 |
|
- |
{ |
385 |
|
- |
// Ignore |
386 |
|
- |
} |
387 |
|
- |
try |
388 |
|
- |
{ |
389 |
|
- |
return new SimpleDate( pFormat, UtilDateAdaptor.fromDateToString( s ).getDate() ); |
390 |
|
- |
} |
391 |
|
- |
catch ( IllegalArgumentException e ) |
392 |
|
- |
{ |
393 |
|
- |
// Ignore |
394 |
|
- |
} |
395 |
|
- |
try |
396 |
|
- |
{ |
397 |
|
- |
return new SimpleDate( pFormat, java.sql.Date.valueOf( s ) ); |
398 |
|
- |
} |
399 |
|
- |
catch ( IllegalArgumentException e ) |
400 |
|
- |
{ |
401 |
|
- |
// Ignore |
402 |
|
- |
} |
403 |
|
- |
try |
404 |
|
- |
{ |
405 |
|
- |
return SimpleDate.fromYMD( pFormat, s ); |
406 |
|
- |
} |
407 |
|
- |
catch ( IllegalArgumentException e ) |
408 |
|
- |
{ |
409 |
|
- |
// Ignore |
410 |
|
- |
} |
411 |
|
- |
try |
412 |
|
- |
{ |
413 |
|
- |
return new SimpleDate( pFormat, SimpleTimestamp.fromString( s ).getDate() ); |
414 |
|
- |
} |
415 |
|
- |
catch ( IllegalArgumentException e ) |
416 |
|
- |
{ |
417 |
|
- |
// Ignore |
418 |
|
- |
} |
419 |
|
- |
TemporalParser parser = new TemporalParser( new DateFormatControl( pFormat ).getFieldOrder() ); |
|
381 |
+ |
// TODO: XXX |
|
382 |
+ |
// try |
|
383 |
+ |
// { |
|
384 |
+ |
// return new SimpleDate( pFormat, new Date( Long.parseLong( s ) ) ); |
|
385 |
+ |
// } |
|
386 |
+ |
// catch ( NumberFormatException e ) |
|
387 |
+ |
// { |
|
388 |
+ |
// // Ignore |
|
389 |
+ |
// } |
|
390 |
+ |
// try |
|
391 |
+ |
// { |
|
392 |
+ |
// return new SimpleDate( pFormat, UtilDateAdaptor.fromUtilDateToString( s ).getWallDate() ); |
|
393 |
+ |
// } |
|
394 |
+ |
// catch ( IllegalArgumentException e ) |
|
395 |
+ |
// { |
|
396 |
+ |
// // Ignore |
|
397 |
+ |
// } |
|
398 |
+ |
// try |
|
399 |
+ |
// { |
|
400 |
+ |
// return new SimpleDate( pFormat, java.sql.Date.valueOf( s ) ); |
|
401 |
+ |
// } |
|
402 |
+ |
// catch ( IllegalArgumentException e ) |
|
403 |
+ |
// { |
|
404 |
+ |
// // Ignore |
|
405 |
+ |
// } |
|
406 |
+ |
// try |
|
407 |
+ |
// { |
|
408 |
+ |
// return SimpleDate.fromYMD( pFormat, s ); |
|
409 |
+ |
// } |
|
410 |
+ |
// catch ( IllegalArgumentException e ) |
|
411 |
+ |
// { |
|
412 |
+ |
// // Ignore |
|
413 |
+ |
// } |
|
414 |
+ |
// try |
|
415 |
+ |
// { |
|
416 |
+ |
// return new SimpleDate( pFormat, SimpleTimestamp.fromString( s ).getDate() ); |
|
417 |
+ |
// } |
|
418 |
+ |
// catch ( IllegalArgumentException e ) |
|
419 |
+ |
// { |
|
420 |
+ |
// // Ignore |
|
421 |
+ |
// } |
|
422 |
+ |
TemporalParser parser = new TemporalParser( new DateFormat( pFormat ).getFieldOrder() ); |
420 |
423 |
|
return parser.parseDate( pFormat, s, null ); |
421 |
424 |
|
} |
422 |
425 |
|
|