sony rao

Greenhorn
+ Follow
since Jun 18, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sony rao

hi all

i have a java program that sends an email with .vcs file as an attachment for meeting request. When user opens the .vcs file and clicks on save and close button, he can see his outlook calendar blocked for the time slot specified.
Suppose the meeting gets cancelled, user should get a cancelled .vcs file.
on saving the file, appointment from outlook calendar should vanish.
iam stuck with cancellation part.
can anybody please suggest me how to create a .vcs file to delete appointment from outlook calendar ...

thanks in advance.
17 years ago
hi Jesper

my very first statement was .....

i have to convert date format of "2008-03-30T05:00:00.000+02:00" to
MM/dd/yyyy hh:mm a

i think this clearly explains that i want to convert datetime in "2008-03-30T05:00:00.000+02:00" format to MM/dd/yyyy hh:mm a format.
[ March 14, 2008: Message edited by: sony rao ]
17 years ago
hi laxman

thanks for your response.

as of now iam using this code

SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
String s1 = "2008-03-30T15:30:00.000+02:00";
s1 = s1.substring(0, s1.indexOf('.'));
try {
System.out.println("Result==> "+sdf1.format(sdf2.parse(s1)));
} catch (Exception e) {
e.printStackTrace();
}
17 years ago
hi laxman

thanks for responding
source date format is "Fri Mar 14 13:50:07 SGT 2008" as per your code

but in my case source date is in "2008-03-14T11:53:31.470+05:00" format
which i need to format it to MM/dd/yyyy hh:mm a
[ March 14, 2008: Message edited by: sony rao ]
17 years ago
hi Henrique

i tried what Jesper said..

Date now = new Date();
System.out.println("date--> " + now);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
String s = df.format(now);
String result = s.substring(0, 26) + ":" + s.substring(27);
System.out.println("result--> " + result);

output:

date--> Fri Mar 14 10:27:31 IST 2008
result--> 2008-03-14T10:27:31.197+05:0

"2008-03-14T10:27:31.197+05:0" is not the format i want my result to be.
it should be in MM/dd/yyyy hh:mm a format
17 years ago
i have given my code that converts date in "yyyy-MM-dd'T'HH:mm:ss.SSS" format to
"MM/dd/yyyy hh:mm a" format.

try{
String s1 = "2001-9-11T15:30:00.000";
Date d = (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")).parse(s1);
String s2 = (new SimpleDateFormat("MM/dd/yyyy hh:mm a")).format(d);
System.out.println("s2 "+s2);
} catch(Exception e) {
e.printStackTrace();
}

but i dont know how to convert if a date is of
"2008-03-30T05:00:00.000+02:00" format


please guide me
17 years ago
checked SimpleDateFormat

"yyyy-MM-dd'T'HH:mm:ss.SSS" corresponds to "2001-9-11T18:15:00.000"

how do i go about with "+02:00" ?
17 years ago
hi all

i have to convert date format of "2008-03-30T05:00:00.000+02:00" to
MM/dd/yyyy hh:mm a

please help me in this

thanks in advance
17 years ago
hi all

iam trying to convert datetime in one timezone to corresponding datetime in
other timezone. iam using jdk 1.5 and jodatime 1.5.1

Iam trying to convert March 30th 2008 2am in Europe/Moscow to equivalent datetime in india.

Europe/Moscow undergoes DST on March 30th 2008 at 2am.
So When i feed this time, iam getting this exception

"Exception in thread "main" java.lang.IllegalArgumentException: Illegal instant due to time zone offset transition: 2008-03-29T23:00:00.000" ...

if i give any datetime other than this, conversion is fine.

here goes my code...

DateTimeZone fromZone = DateTimeZone.forID("Europe/Moscow"); DateTimeZone toZone = DateTimeZone.forID("Asia/Calcutta");
//yyyy mm dd hh mm ss ms
DateTime dt = new DateTime(2008, 03, 30, 02, 0, 0, 0, fromZone);
System.out.println(dt.toDateTime(toZone));


Please help me in finding a solution.
Thanks in advance.
[ March 11, 2008: Message edited by: sony rao ]
17 years ago
hi

i am facing problem regarding pop up window. From my application i am sending
mails to my application users. In the mail i am supposed to provide a link.
Upon clicking the link, a pop up window should open with a static jsp in it.

how can i do that? i am using struts and jsp.
hi all

iam working on timezone conversion. when source and destination timezones dont fall under DST my conversion function is working fine. But when any timezone is under DST, conversion is not appropriate.iam using jdk1.5.0_01 and jre1.5.0_01. i also have tzupdater.jar in my classpath

Iam trying to convert 1/10/2007 in Pacific/Auckland to equivalent time in Africa/Casablanca.

here goes my code...
{
TimeZone tz1=TimeZone.getTimeZone("Pacific/Auckland");
int fromDST=tz1.getDSTSavings();
TimeZone tz2=TimeZone.getTimeZone("Africa/Casablanca");
int toDST=tz2.getDSTSavings();
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR,2007);
cal.set(Calendar.MONTH,9);
cal.set(Calendar.DATE,1);
cal.set(Calendar.HOUR_OF_DAY,HtmlHelper.getHourValueInt
(Integer.parseInt("12"),"AM")); //getHourValueInt - method that
gives hour value in terms of AM PM
cal.set(Calendar.MINUTE,0);
convertLocalToLocalWithDST(new Timestamp(cal.getTime().getTime())
,tz1,fromDST,tz2,toDST));
}

public static Timestamp convertLocalToLocalWithDST(Timestamp timestamp, TimeZone fromZone,int fromDST, TimeZone toZone,int toDST) {

return convertGmtToLocalWithDST(convertLocalToGmtWithDST(timestamp, fromZone,fromDST), toZone,toDST);
}


public static Timestamp convertLocalToGmtWithDST(Timestamp timestamp, TimeZone localZone,int fromDST) {
Timestamp newTimestamp = null;
if (timestamp != null) {
Calendar calendar = new GregorianCalendar(localZone);
calendar.setTime(timestamp);
calendar.set(Calendar.DST_OFFSET,fromDST);
int zoneOffset = calendar.get(Calendar.ZONE_OFFSET);

if(localZone.inDaylightTime(timestamp)){
newTimestamp = new Timestamp(calendar.getTime().getTime() - zoneOffset - fromDST);
}else{
newTimestamp = new Timestamp(calendar.getTime().getTime() - zoneOffset + fromDST);
}

}
return newTimestamp;
}


public static Timestamp convertGmtToLocalWithDST(Timestamp timestamp, TimeZone localZone,int toDST) {
Timestamp newTimestamp = null;
if (timestamp != null) {
Calendar calendar = new GregorianCalendar(localZone);
calendar.setTime(timestamp);
calendar.set(Calendar.DST_OFFSET,toDST);
int zoneOffset = calendar.get(Calendar.ZONE_OFFSET);

if(localZone.inDaylightTime(timestamp)){
newTimestamp = new Timestamp(calendar.getTime().getTime() + zoneOffset + toDST );
}
else{
newTimestamp = new Timestamp(calendar.getTime().getTime() + zoneOffset + toDST +toDST );
}
}
return newTimestamp;
}

converted time should be 30 Sep 2007 11am but iam getting 30 Sep 2007 12am

can anybody please help me out
[ November 08, 2007: Message edited by: sony rao ]
17 years ago
hi

is it possible to create and write a file into OutputStream without saving the file physically onto any drive. if so how?

thank you in advance
17 years ago
hello

is there anyway to specify event DTSTART as yyyy/mm/dd hh/mm/ss instead of yyyymmddThhmmssZ.


thank you in advance.
17 years ago
hello

iam supposed to populate a drop down menu based on the value selected in another drop down menu using ajax. i have to use jsp, servlet(for retrieving values from database). can anybody please share links, tutorials or code regarding this. (no php)
hello

i need to set cookies on the client machine say for example in C:\Documents and Settings\users\Cookies. how do i do it with the help of servlets. can anyone please guide me. iam completely lost. thanks in advance.
17 years ago