|
From: <cl...@br...> - 2006-07-21 12:39:18
|
Dear Simon,
correct answer, you got it ! I did a full import of the SQL package at
the start of the script.
Obviously the sql date constructors do not match the standard
java.util.Date class. Once
done the access to SQL functions, it overloaded with the SQL Date class.
Will correct it
by doing a better qualified import of the classes from Java SQL package.
Thanks for your help, problem fixed.
Regards,
Claude
..
from java.sql import * <== will correct this statement !
from java.util import Date
constructors for java.sql.Date
Date(int year, int month, int day)
Date(long date)
constructor for java.util.Date
Date()
and others
"Simon Brunning" <si...@br...>
Sent by: jyt...@li...
07/21/2006 08:49 AM
To
"cl...@br..." <cl...@br...>
cc
jyt...@li...
Subject
Re: [Jython-users] intermittent run time error with Java date
On 7/21/06, cl...@br... <cl...@br...> wrote:
One thing I notice:
> from java.util import Date
> from java.util import Locale
> from java.text import NumberFormat
> from java.text import SimpleDateFormat
> from time import time, ctime
>
> 83 # set first day of current month
> 84 formatter = SimpleDateFormat("yyyy-MM-dd")
> 85 today = Date()
> <====== causing error
> 86 sqltoday = formatter.format(today)
> 87 firstdayofmonth = sqltoday[0:8] + '01'
> 88 System.out.println("First Day of Month = " + firstdayofmonth)
>
> Error message:
> Traceback (innermost last):
> File "C:\Jetty\jetty-5.1.10\webapps\test\FeedWriter.py",
> line 85, in doPost
> TypeError: java.sql.Date(): expected 1 or 3 args; got 0
This is a java.sql.Date, not a java.util.Date. You don't do a:
from java.sql import Date
somewhere else in your script, do you?
--
Cheers,
Simon B,
si...@br...,
http://www.brunningonline.net/simon/blog/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jython-users mailing list
Jyt...@li...
https://lists.sourceforge.net/lists/listinfo/jython-users
|