Re: 1.5 Stared blind patterndateconverter

2012-04-16 Thread nino martinez wael
seems to be an issue with joda time as this fails too:

@Test
public void testJoda(){
 DateTimeFormatter withPivotYear =
DateTimeFormat.forPattern("HH:mm").withLocale(new Locale("da_DK"));
Calendar instance = Calendar.getInstance();
instance.set(1900, 0, 1, 0, 0,0);
Date dateModified=instance.getTime();
 DateTime dt = new DateTime((dateModified).getTime(),
DateTimeZone.getDefault());

String result=withPivotYear.print(dt);
Assert.assertTrue("00:00".equalsIgnoreCase(result));

 }

Looking into it:

my instance of dt becomes this "1899-12-31T23:09:21.857+00:09:21" ! Gonna
ask the joda guys why this happens!


2012/4/17 nino martinez wael 

> I could be something with the time zone:
>
> this fails aswell:
>
>   PatternDateConverter converter=new PatternDateConverter("HH:mm", false);
> Calendar instance = Calendar.getInstance(); instance.set(1900, 0, 1, 0,
> 0,0); Date dateModified=instance.getTime(); String
> result=converter.convertToString(dateModified, new Locale("da_DK"));
> Assert.assertTrue("00:00".equalsIgnoreCase(result));
>
> pretty strange.
>
> BUT this does not:
>
> @Test
> public void testSimpleDateformatter(){
>  SimpleDateFormat sdf=new SimpleDateFormat("HH:mm");
> Calendar instance = Calendar.getInstance();
>  instance.set(1900, 0, 1, 0, 0,0);
> Date dateModified=instance.getTime();
>  String result=sdf.format(dateModified);
> Assert.assertTrue("00:00".equalsIgnoreCase(result));
>
>  }
>
> 2012/4/16 Hans Lesmeister 2 
>
>> Hi,
>>
>> if I run your test, the result is just a space.
>> If I change the Date-Pattern to "HH:mm", the test goes green
>> May be you are in the wrong time-zone... :-)
>>
>> -
>> --
>> Regards,
>> Hans
>>
>> http://cantaa.de
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/1-5-Stared-blind-patterndateconverter-tp4561565p4561641.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez
>
>


-- 
Best regards / Med venlig hilsen
Nino Martinez


Re: 1.5 Stared blind patterndateconverter

2012-04-16 Thread nino martinez wael
I could be something with the time zone:

this fails aswell:

  PatternDateConverter converter=new PatternDateConverter("HH:mm", false);
Calendar instance = Calendar.getInstance(); instance.set(1900, 0, 1, 0,
0,0); Date dateModified=instance.getTime(); String
result=converter.convertToString(dateModified, new Locale("da_DK"));
Assert.assertTrue("00:00".equalsIgnoreCase(result));

pretty strange.

BUT this does not:

@Test
public void testSimpleDateformatter(){
SimpleDateFormat sdf=new SimpleDateFormat("HH:mm");
Calendar instance = Calendar.getInstance();
instance.set(1900, 0, 1, 0, 0,0);
Date dateModified=instance.getTime();
String result=sdf.format(dateModified);
Assert.assertTrue("00:00".equalsIgnoreCase(result));

 }

2012/4/16 Hans Lesmeister 2 

> Hi,
>
> if I run your test, the result is just a space.
> If I change the Date-Pattern to "HH:mm", the test goes green
> May be you are in the wrong time-zone... :-)
>
> -
> --
> Regards,
> Hans
>
> http://cantaa.de
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/1-5-Stared-blind-patterndateconverter-tp4561565p4561641.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Best regards / Med venlig hilsen
Nino Martinez


Re: 1.5 Stared blind patterndateconverter

2012-04-16 Thread Hans Lesmeister 2
Hi,

if I run your test, the result is just a space.
If I change the Date-Pattern to "HH:mm", the test goes green
May be you are in the wrong time-zone... :-)

-
-- 
Regards, 
Hans 

http://cantaa.de 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/1-5-Stared-blind-patterndateconverter-tp4561565p4561641.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: 1.5 Stared blind patterndateconverter

2012-04-16 Thread Martin Grigorov
Maybe because computers started care about time since Jan 1 1970 ? :-)

On Mon, Apr 16, 2012 at 4:42 PM, nino martinez wael
 wrote:
> I've been looking at this for too long,
>
> why does this test fail, why does result becomes "23:09" ?
>
> @Test
> public void testPatternConverter(){
> PatternDateConverter converter=new PatternDateConverter(" ", false);
> Calendar instance = Calendar.getInstance();
> instance.set(1900, 0, 1, 0, 0,0);
> Date dateModified=instance.getTime();
> String result=converter.convertToString(dateModified, Locale.ENGLISH);
> Assert.assertTrue("00:00".equalsIgnoreCase(result));
>
>  }
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org