• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Date issues!

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I just found this resolution for a a Date issue that i'm having, Thanks very much!, but assume that Sun has resolved their lack of Date handling routines by now?

If not, i'm totally shocked!, but again assume there must be a good reason?

A SAS tool that i use has a myriad of Date handling routines and documentation!

Thanks much for any insights on this!
 
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm unable to determine if you have a question. What insights are you looking for?

Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Steve!

I quess i'm really suprised that Sun has made the Date handling so confusing, ie what ever happened to the good ole "d.getMonth" ect!

I've been trying to get this to work all morning to no avail, do you see anything obvious Steve?

$ ksh t.ksh
Note: t.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1. Wed Sep 21 04:24:54 EDT 2005
ERROR: Cannot parse "Wed Sep 21 04:24:54 EDT 2005"

String ldt= new String("Wed Sep 21 04:24:54 EDT 2005");
Date dto= new Date(ldt);

String dateString = dto.toString();
System.out.println(" 1. " + dateString);

SimpleDateFormat format = new SimpleDateFormat("yyMMdd");

try {
Date parsed = format.parse(dateString);
System.out.println(" 2. " + parsed.toString());
}
catch(ParseException pe) {
System.out.println("ERROR: Cannot parse \"" + dateString + "\"");
}

Thanks for any inputs on this Steve!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic