• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting the correct date  RSS feed

 
Brad Lahr
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works OK for me on 1.4.2 Beta
 
Peter Tersteeg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compiles and runs really well on SDK1.4.1_02
Output == 14 May 2003.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!