Advertisement

06.06.2008 at 01:25PM PDT, ID: 23465003
[x]
Attachment Details

Problem with timezone when changing Dateformat

Asked by gbvreddy in Java Programming Language

Tags: Sun, Java, 1.3

Hi, I am using java1.3 and when trying to modify dateformat from 2004-12-07T17:00:00-05:00 to Fri, 17 Dec 2004 17:00:00 -0500, it is changing to Fri, 17 Dec 2004 17:00:00 EST" instead of "Fri, 17 Dec 2004 17:00:00 -0500". Please advice. When i tried ti change the "String DATE_FORMAT1 = "EEE, dd MMM yyyy HH:mm:ssz";" to "String DATE_FORMAT1 = "EEE, dd MMM yyyy HH:mm:ssZ";" it is throwing "Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'Z'" Please advice. Heres my program.

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
package com.sitemap;
 
import java.text.ParseException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
 
public class DateConverter {
 
/**
* @param args
*/
public static void main(String[] args) {
 
String inputDate= "2004-12-07 17:00:00-05:00";
System.out.println ("original String ="+inputDate);
 
 
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssz");
String DATE_FORMAT1 = "EEE, dd MMM yyyy HH:mm:ssz";
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT1);
try {
Date myDate = format.parse(inputDate);
System.out.println("converted is =" + sdf.format(myDate));
} catch (ParseException e) {
 
e.printStackTrace();
}
 
}
}
 
 
[+][-]06.06.2008 at 01:55PM PDT, ID: 21732621

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 02:23PM PDT, ID: 21732804

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 02:34PM PDT, ID: 21732866

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 03:18PM PDT, ID: 21733097

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 03:30PM PDT, ID: 21733160

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: Sun, Java, 1.3
Sign Up Now!
Solution Provided By: objects
Participating Experts: 2
Solution Grade: B
 
 
[+][-]06.06.2008 at 03:39PM PDT, ID: 21733205

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 11:21AM PDT, ID: 21753620

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 05:53PM PDT, ID: 21756116

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628