Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Java in General
DateFormat for Apache Common Log Format date?
Chris Treglio
Ranch Hand
Posts: 64
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Does anyone know of a DateFormat implementation designed to work with the date format Apache uses in its logs? The format looks like
16/Jun/2003:09:07:03 -0400
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
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 64
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can you post an example? all that gives me is a ParseException.
Michael Böckling
Greenhorn
Posts: 1
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Its easy to forget, but the locale must match. This should work:
SimpleDateFormat df = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z", Locale.US); Date d = df.parse("26/Mar/2015:01:53:59 +0100");
Junilu Lacar
Sheriff
Posts: 17735
302
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Displaying correct date format
how to make different date format validation ?
Date Converting String to Date
Date Format Quickie
Trying to parse a String to a Date
More...