f



warning: [deprecation] in java.util.Date(java.lang.String) has been deprecated

Dear Java Programmers,

When compiling my Java program I get the following warning:
"warning: [deprecation] in java.util.Date(java.lang.String) has been
deprecated" on for example this statement:
new Date("09/23/2003")
The code is used to generate the dates on a webpage. Depending on the
language of the webpage
the generated format is different. For example English (see "Date" and
"Choose publication" on the page opened):
http://home.scarlet.be/kenya-belgium/list_5_en/a_kenyan_birthday_party_and_a_belgian_birthday_party.html

French:
http://home.scarlet.be/kenya-belgium/liste_5_fr/une_fete_d'anniversaire_kenyanne_et_une_fete_d'anniversaire_belge.html
s
Should I use another class in stead of Date? If yes, which one?

Best regards,

BoBi

0
1kdg (4)
12/13/2006 5:19:34 AM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

3 Replies
2648 Views

Similar Articles

[PageSpeed] 22

BoBi wrote:
...
> "warning: [deprecation] in java.util.Date(java.lang.String) has been
> deprecated"
.....
> Should I use another class in stead of Date?

Yes.

>..If yes, which one?

Mentioned in the JavaDocs* for the constructor(s) of Date.
<http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html#constructor_summary>
(* you should bookmark them, and consult them regularly..)

Andrew T.

0
andrewthommo (3108)
12/13/2006 5:53:11 AM
Andrew Thompson wrote:
> BoBi wrote:
> ..
> > "warning: [deprecation] in java.util.Date(java.lang.String) has been
> > deprecated"
> ....
> > Should I use another class in stead of Date?
>
> Yes.
>
> >..If yes, which one?
>
> Mentioned in the JavaDocs* for the constructor(s) of Date.
> <http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html#constructor_summary>
> (* you should bookmark them, and consult them regularly..)
>
> Andrew T.

You can use java.util.Calendar or java.text.SimpleDateFormat depends
from your preference

0
agavelian (20)
12/13/2006 6:32:07 AM
Hi,

Thanks both of you. I'll be checking your suggestions out for solving
my warning.

:c=E0, BoBi

vahan schreef:

> Andrew Thompson wrote:
> > BoBi wrote:
> > ..
> > > "warning: [deprecation] in java.util.Date(java.lang.String) has been
> > > deprecated"
> > ....
> > > Should I use another class in stead of Date?
> >
> > Yes.
> >
> > >..If yes, which one?
> >
> > Mentioned in the JavaDocs* for the constructor(s) of Date.
> > <http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html#constructo=
r_summary>
> > (* you should bookmark them, and consult them regularly..)
> >
> > Andrew T.
>
> You can use java.util.Calendar or java.text.SimpleDateFormat depends
> from your preference

0
1kdg (4)
12/15/2006 4:51:23 AM
Reply:

Similar Artilces:

java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)
Hi All I am having the torque3.1.jar and postgresql-7.4. I have compiled the new jdbc driver called as postgresql.jar and have placed it in the lib directory from where the ant scripts catch the jars. Whenever i try to access through torque gestList = BaseGestlistPeer.doSelect(new Criteria()); this error arises java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460) at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653) at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java...

java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException
Hi, I am new to DB2. I am getting this error while loading the DB2Driver. I don't have any idea about where i might have gone wrong. please help me. Below is the stack trace. Stack Trace: java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method) at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:245) at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:130) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Cla...

CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean
Hello, I have discovered a hidden error. My project was working for awhile, but then I started to get the below error. My error comes from the fact that I'm using a checkbox in a jtable, and I'm using the below "getColumnClass". Thank you, compile: run: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at javax.swing.JTable$BooleanRenderer.getTableCellRendererComponent(JTable.java:5412) at javax.swing.JTable.prepareRenderer(JTable.java:5735) at javax.swing.plaf.basic.BasicTableU...

java.lang vs java.util
Surprising to see something defined in java.lang <http://developer.android.com/reference/java/lang/Iterable.html> depend on something defined in java.util <http://developer.android.com/reference/java/util/Iterator.html>. Surely the hierarchy should go the other way? On 4/1/2011 9:11 PM, Lawrence D'Oliveiro wrote: > Surprising to see something defined in java.lang > <http://developer.android.com/reference/java/lang/Iterable.html> depend on > something defined in java.util > <http://developer.android.com/reference/java/util/Iterator.html>. > > ...

modifying java.lang.String.java
Hi, I'm trying to modify java.lang.String.java and add the modified String.class to rt.jar [THIS IS FOR MYSELF ONLY AND WILL NOT BE DEPLOYED]. I cannot add "private final boolean tainted[] = new boolean[5];" to String.java. If I do, it still compiles and I can add it to rt.jar and compile a test program against it. However, the JVM crashes with a strange message: java.lang.IllegalArgumentException: name can't be empty at java.security.BasicPermission.init(Unknown Source) at java.security.BasicPermission.<init>(Unknown Source) at java....

XML-RPC
Hello, I am getting an error "XML-RPC - java.lang.ClassCastException: java.util.Date" when I call the "XmlRpcClient" execute method. I believe the underlying classes are having trouble parsing the result from the time.xmlrpc.com/RPC2:80 XML-RPC service. I apologize that I could not navigate the Apache bug reporting and search system. I hope someone can recognize what is up with this. Thank you in advance for any help, Michael import java.util.Vector; import java.util.Hashtable; import org.apache.xmlrpc.*; public class GetTime { private final static String serv...

java.io.File to java.lang.String
What's the best way to get the contents of a file represented by ajava.io.File object into a String? Benjamin wrote:> What's the best way to get the contents of a file represented by a> java.io.File object into a String?> You don't specify what you consider best so how about simple as best? Now for my curiosity, why would you want to do this?import java.io.*;public class test { public static void main(String[] args) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); File f = new File(args[0]); FileInputStream fis = new ...

java.lang.Set with elements of type java.lang.Set
Roughly I do something along the lines of: Set set = new HashSet(); Set elem = new HashSet(); set.add(elem); // now we change the elem and add it again to the set elem.add(some object here); set.add(elem); I found out the hard way that 'set' may now contain 'elem' either once or twice, the reason being that 'elem.add()' changes the hashCode of elem such that it is not noticed that it is in 'set' already on the 2nd 'set.add()'. Question: What I would actually want is an IdentityHashSet() set = new IdentityHashSet() but this does not...

to use import java.lang.* or import java.lang.Math or none at all?
Hi guys, i knew that by default all java.lang classes will be imported by the compiler during compilation. but, to make it easier for the computer, should i specify which class i really will be using? does this action will boost the performance during compilation and runtime or not a matter at all? the answer to this post will definitely affect my programming style in the future when i'm considering "to import or not to import"... hmm,,, thanks in advance. JPractitioner wrote: > i knew that by default all java.lang classes will be imported by the > compiler during com...

Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object
Good day to all, I have installed the j2se/netbeans binary bundle on red hat 9. I can run everything perfectly as root but when I try to compile with any other user I get: Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object When I saw this it seemed like a permissions problem but I checked the permissions and everything seemed fine. All users have execute permissions of javac and java. I have read other threads dealing with the same or similar problem but have not reached any solution yet. I would appreciate if anyone that has run into this type o...

Java in Java
Is it possible to download a Java app (applet etc?) and run it inside a desktop Java app? -- Dirk http://www.transcendence.me.uk/ - Transcendence UK http://www.theconsensus.org/ - A UK political party http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff Dirk Bruere at NeoPax wrote: > Is it possible to download a Java app (applet etc?) and run it inside a > desktop Java app? > Quite likely, but you won't necessarily get the same security model, unless you were careful about it. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/&g...

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these commands: # zcat jdk-6u7-solaris-sparc.tar.Z | tar -xf - # pkgadd -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx # /usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -version Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object # ls /usr/jdk/instances/ jdk1.5.0 jdk1.6.0 # uname -a SunOS sun1 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500 Please help to fix the error. Thanks. TsanChung wrote: > I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these > commands: > # zcat jdk-6u7-so...

Java Java
Have my first Open Source Linux Java Project. Working on a second right now. Coming out with a distro called OPEN*WINDOWS. It will be at www.black-and-company.com tab wrote: > Have my first Open Source Linux Java Project. > Working on a second right now. > > Coming out with a distro called OPEN*WINDOWS. > > It will be at www.black-and-company.com > Wasn't that the whole point of Lindows? Oh, right, we didn't care for that either. tab wrote: > Have my first Open Source Linux Java Project. > Working on a second right now. > > Coming out with a ...

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on java1.4.2_04 (JIT: null) My Java version is: java version "1.4.2_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode) My CLASSPATH includes: jdom.jar xerces.jar jython.jar jt400.jar log4j-1.2.8.jar commons-httpclient-2.0.jar When I just try to perform the import statements from example code I get the error pasted below....

Web resources about - warning: [deprecation] in java.util.Date(java.lang.String) has been deprecated - comp.lang.java.programmer

Deprecation - Wikipedia, the free encyclopedia
Deprecation is an attribute applied to a computer software feature, characteristic, or practice to indicate that it should be avoided (often ...

Preparing for the Unity Web Player and other NPAPI Plug-in Deprecations on Chrome
A couple of internet browsers recently announced changes that will impact Unity developers, and we wanted to share with you details on these ...

Facebook’s Application Profile Box Deprecation Process Is Starting Now
Late last week, Facebook said that its profile box deprecation process, which it originally announced a few months ago, would begin this week. ...

Joe Hockey's farewell speech a potpourri of self-deprecation and denial
Joe Hockey's farewell speech helps explain why he is so well-liked across the political divide and why he failed to make the transition from ...

Selfie-Deprecation
Selfie-Deprecation

Changes to deprecation policies and API spring cleaning
... moving and innovating fast, too. In an effort to align our pace of development with the market, we did a careful analysis of our API deprecation ...

Lenovo reportedly to raise PC prices in China because of Chinese yuan deprecation
China-based Lenovo reportedly is planning to raise its PC prices in China at the end of August due to a significant depreciation of the country's ...

When Self Deprecation Goes Too Far
Everyone loves a little self-deprecating humor, right? Well, everyone except your boss. In these three workplace scenarios, it's time to rein ...

In Search of Self-Deprecation, Boston Is Confronted With the Reality that Boston Sucks
"Boston," a cramped Hollywood crime movie set populated by primarily by the lesser Wahlbergs, is engaged in a gleeful back-and-forth exchange ...

Fix deprecation warning by miguelcma · Pull Request #15 · PunchThrough/Bean-iOS-OSX-SDK · GitHub
Bean-iOS-OSX-SDK - Punch Through Design's SDK for speeding up development with the LightBlue Bean development platform

Resources last updated: 1/29/2016 11:07:49 PM