It's not a secret anymore!
The moose likes Java in General and the fly likes DateFormat for Apache Common Log Format date? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "DateFormat for Apache Common Log Format date?" Watch "DateFormat for Apache Common Log Format date?" New topic
Author

DateFormat for Apache Common Log Format date?

Chris Treglio
Ranch Hand

Joined: Jun 18, 2001
Posts: 64
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

Joined: Oct 21, 2002
Posts: 88
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 ]

Sun Certified Java Programmer
Chris Treglio
Ranch Hand

Joined: Jun 18, 2001
Posts: 64
can you post an example? all that gives me is a ParseException.
Michael Böckling
Greenhorn

Joined: Mar 27, 2015
Posts: 1
Its easy to forget, but the locale must match. This should work:

Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 6310
    
  15

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


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DateFormat for Apache Common Log Format date?
 
It's not a secret anymore!