Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DateFormat for Apache Common Log Format date?

 
Chris Treglio
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know of a DateFormat implementation designed to work with the date format Apache uses in its logs? The format looks like

The SimpleDateFormat with a format string like "dd/MMM/yyyy:hh:mm:ss z" sort of works, but the time zone offset doesn't parse right.
 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try Z instead of z.i guess it will work
the string will be "dd/MMM/yyyy:hh:mm:ss Z"
[ July 09, 2003: Message edited by: Kumar BT ]
 
Chris Treglio
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post an example? all that gives me is a ParseException.
 
Michael Böckling
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its easy to forget, but the locale must match. This should work:

 
Junilu Lacar
Bartender
Pie
Posts: 7770
62
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Michael!

It's quite an old thread that you resurrected here but thanks for giving it some closure. I actually learned something from your reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic