473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DateFormat.parse issues

I can't get dates to parse with any accuracy. I have a date like this,
for example:

Fri May 25 07:58:46 GMT 2007

I am using a SimpleDateFormat with a format string of:

EEE MMM dd HH:MM:SS z yyyy

When I parse the date and print it back out, it thinks it was:

Tue Oct 25 02:00:00 CDT 2011

Which is not even remotely the same except for the "25".

Any tips on using the date parser? I guess I could just extract all the
fields into integers and make a date out of that, but it seems like
there is built-in functionality for this and I want it to work!

Thanks,
Jeremy
May 24 '07 #1
2 7624
Jeremy <je****@pinacol.comwrote in news:6%n5i.11406$qJ1.8078
@newsfe18.lga:
I can't get dates to parse with any accuracy. I have a date like this,
for example:

Fri May 25 07:58:46 GMT 2007

I am using a SimpleDateFormat with a format string of:

EEE MMM dd HH:MM:SS z yyyy

When I parse the date and print it back out, it thinks it was:

Tue Oct 25 02:00:00 CDT 2011
Your format string is wrong , try :

EEE MMM dd HH:mm:ss z yyyy

Bye.
--
Real Gagnon from Quebec, Canada
* Java, Javascript, VBScript and PowerBuilder code snippets
* http://www.rgagnon.com/howto.html
* http://www.rgagnon.com/bigindex.html
May 25 '07 #2
Real Gagnon wrote:
>
Your format string is wrong , try :

EEE MMM dd HH:mm:ss z yyyy

Bye.
Yep, you're right. Thanks for spotting that.

Jeremy
May 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: chrisben | last post by:
I have a DateTime type data for my grid column. I want to display it in the cells as MONYR, as MAR05 JAN05 etc. Cannot find it in DateTime format, is there any quick way to do it (instead of...
0
by: Phil | last post by:
My regional setting (on Win2000) is: (General Tab)Locale = English (US) (Date Tab), short date = MM/dd/yy When I ask .Net DateFormat.ShortDatePattern, I get MM/dd/yyyy Now, where does the...
1
by: Graham Blandford | last post by:
Hi all, Can anyone tell me how I go about setting a custom date format (or any other format for that matter) to a textbox that has a databinding? In VB6 I would do something like 'set...
5
by: Agnes | last post by:
If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot -- ..
4
by: newtophp2000 | last post by:
Hello, I receive a file containing some character fields along with a date. The date values in the file are formatted as "dd/mm/yy", that is 2-digit day, 2-digit month, and 2-digit year. The...
0
by: pankajol82 | last post by:
Hi all I am using following code to change regional setting at run time its not giving any error but at the same time the format of date is not changing. Dim DateFormat As New...
1
zigman68
by: zigman68 | last post by:
I have a problem with the DateFormat() Function that is driving me nuts! I am downloading a csv and then parsing through it, then inserting into a SQL 2005 DB. Here is the problem. ... A number of...
3
dzenanz
by: dzenanz | last post by:
String input="4/3/08 9:57 AM"; DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); StartDate = df.parse(input); out.println(StartDate.toLocaleString());//"Apr 3, 2008 12:00:00 AM" ...
6
by: =?Utf-8?B?RGF2aWRN?= | last post by:
Hello, I have an XML file generated from a third party application that I would like to parse. Ideally, I plan on having a windows service setup to scan various folders for XML files and parse the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.