/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jl.tz;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
/**
*
* @author Rishitha
*/
public class TimeZoneExample {
public static void main(String args[]){
Calendar indCal = Calendar.getInstance();
Calendar usCal = Calendar.getInstance();
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
usCal.setTimeZone(tz);
SimpleDateFormat sf = new SimpleDateFormat();
System.out.println("Indian Time "+sf.format(indCal.getTime()));
SimpleDateFormat usSf = new SimpleDateFormat();
usSf.setTimeZone(tz);
System.out.println("Los_Angeles Time "+usSf.format(usCal.getTime()));
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jl.tz;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
/**
*
* @author Rishitha
*/
public class TimeZoneExample {
public static void main(String args[]){
Calendar indCal = Calendar.getInstance();
Calendar usCal = Calendar.getInstance();
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
usCal.setTimeZone(tz);
SimpleDateFormat sf = new SimpleDateFormat();
System.out.println("Indian Time "+sf.format(indCal.getTime()));
SimpleDateFormat usSf = new SimpleDateFormat();
usSf.setTimeZone(tz);
System.out.println("Los_Angeles Time "+usSf.format(usCal.getTime()));
}
}
No comments:
Post a Comment