File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Getting the correct date Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Getting the correct date" Watch "Getting the correct date" New topic
Author

Getting the correct date

Brad Lahr
Greenhorn

Joined: May 09, 2003
Posts: 9
Could someone tell me what I am doing wrong? This seems so simple.
> java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
> java myDate
Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.text.DateFormat.format(DateFormat.java:279)
at java.text.Format.format(Format.java:133)
at myDate.main(myDate.java:15)
> cat myDate.java

Thanks in advance for any help.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Works OK for me on 1.4.2 Beta


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Peter Tersteeg
Greenhorn

Joined: May 12, 2003
Posts: 3
I've built and run this using java 1.4.1_01-b01 with no problems.
Try running with:
>java -classpath "<the directory path here>" myDate
[ May 14, 2003: Message edited by: Peter Tersteeg ]
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
Compiles and runs really well on SDK1.4.1_02
Output == 14 May 2003.


doco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the correct date
 
Similar Threads
Resolving most specific method
Anonymous Classes & Exception Handling
Date Format ,Please help!
Getting the Correct Time
How to get current date in JS