Noor Donur

Greenhorn
+ Follow
since Dec 13, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Noor Donur


Thanks for your replies.

I checked for zones that Java SDK can understand as per Paul's guidance.

TimeZone.getAvailableIDs();

I found "Brazil/East" value is equivalent to my app's value, (GMT-03:00) Brazil Time (Brasilia).

When ran the below code:

package com.dates;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;

public class DateWitZoneSuffix {

static String sCurrDate = "Tue Jan 08 11:31:05 GMT 2013";
static DateFormat inputDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
static String outputDateStr = "MM/dd/yyyy hh.mm.ss aaa z";
static DateFormat outputDateFormat = new SimpleDateFormat(outputDateStr);
@SuppressWarnings("rawtypes")
static Map zoneIds = new HashMap<String, String>();

@SuppressWarnings("unchecked")
public static void main(String[] args) throws ParseException {
Date inputDate = inputDateFormat.parse(sCurrDate);
Calendar cal = Calendar.getInstance();
//outputDateFormat.setTimeZone(TimeZone.getTimeZone("(GMT-03:00) Brazil Time (Brasilia)")); //(GMT+08:00) Western Australia Time (Perth)
zoneIds.put("(GMT-03:00) Brazil Time (Brasilia)", "Brazil/East");
outputDateFormat.setTimeZone(TimeZone.getTimeZone((String)zoneIds.get("(GMT-03:00) Brazil Time (Brasilia)"))); //(GMT+08:00) Western Australia Time (Perth)
cal.setTime(inputDate);
System.out.println(outputDateFormat.format(cal.getTime()));
}
}


// Got expected output
// 01/08/2013 09.31.05 AM BRST

Similarly do i need to find out 81 values for all zones that my app has that Java SDK can understand?

But how to determine if the time [Both past and present] was/is in daylight savings or not?
10 years ago
Hi,

Please keep on updating it.

Look and feel are really very well.

Makes people to spend more time in coderanch.com
10 years ago

I 've a drop-down list of such lengthy zone ids dates which needs to be formatted to the given out date format with zone suffixes, The date is getting formatted correctly but how to get the zone suffixes?
10 years ago

Dear,

Take a deep breath and relax.

Have a glance, concentrate and try to analyze the suggestions.

Please don't be in hurry.

If you make this a practice you can understand, work easily and can teach yourself.

12 years ago