You are not logged in.

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

1

Wednesday, May 27th 2009, 10:09pm

What about Date and java#util#Date?

Hi,



the problems with Date are really strange

what kind of beast is Date in Jabaco? and

what kind of beast is Date in Java (resp. java#util#Date)?



the problem is that java#util#Date seams not to fit in java#util#Date.

sounds like a strange bug? yes it does ...

look at this:

Jabaco Source

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
Public Sub Form_Load()
   
   Dim Cal As New java#util#GregorianCalendar
   Dim jd As java#util#Date
   Dim dt As Date
   
   'jd = Cal.getTime   'Uuurgh
                       'Auto conversion 'Date' to 'java/util/date' is not supported!
                       
   'OK then let's do it this way and convert it afterwards... (?)
   dt = Cal.getTime
   MsgBox dt
   
   jd = CJUDate(dt)
   
   'but when giving to a function the next problem:
   'MsgBox Foo(jd)     'Uuurgh
                       'Auto conversion 'Date' to 'java/util/date' is not supported!
                       
End Sub
Private Function Foo(d As java#util#Date) As String
    Foo = d.toGMTString
End Function
Private Function CJUDate(d As Date) As java#util#Date
   CJUDate = New java#util#Date
   Dim y As Integer = Year(d)
   CJUDate.setYear(y - 1900)
   CJUDate.setMonth(Month(d))
   CJUDate.setDate(Day(d))
   CJUDate.setHours(Hour(d))
   CJUDate.setMinutes(Minute(d))
   CJUDate.setSeconds(Second(d))   
End Function




greetings

OlimilO

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Thursday, May 28th 2009, 1:11pm

Hi,
any new findings compared to our previous posts?

Cheers!

A1880

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

3

Thursday, May 28th 2009, 2:35pm

You are right. It's a bug. Will be fixed in next version.

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

4

Thursday, May 28th 2009, 2:45pm

Hi A1880,

Quoted

any new findings compared to our previous posts

Our previous post ... well wasn't it about the buggy Now function?

The new finding is that I think I found a new bug:

A variable of java#util#Date seems not to fit into a variable of java#util#Date when you deliver it to a function call



but... Aahh OK, what i did not really realize that I simply have to use Conversion.CDate - not nice but OK

Source code

1
2
3
4
5
6
7
8
Public Sub Form_Load()
   Dim jd As java#util#Date
   MsgBox Foo(jd)                   'NOop
   MsgBox Foo(Conversion.CDate(jd)) 'Yes,OK
End Sub
Public Function Foo(d As java#util#Date) As String
    Foo = d.toLocaleString
End Function






greetings

OlimilO

Rate this thread
WoltLab Burning Board