Example usage for java.util Calendar getInstance

List of usage examples for java.util Calendar getInstance

Introduction

In this page you can find the example usage for java.util Calendar getInstance.

Prototype

public static Calendar getInstance(Locale aLocale) 

Source Link

Document

Gets a calendar using the default time zone and specified locale.

Usage

From source file:Main.java

public static void main(String[] args) {

    Calendar cal = Calendar.getInstance(Locale.CANADA);

    // print the date for canada 
    System.out.println("Date And Time in Canada Is: " + cal.getTime());
}

From source file:Main.java

public static void main(String[] args) {

    TimeZone tz1 = TimeZone.getTimeZone("GMT");
    Calendar cal1 = Calendar.getInstance(tz1);

    // display time zone for both calendars
    System.out.println("GMT: " + cal1.getTimeZone().getDisplayName());
}

From source file:Main.java

public static void main(String[] args) {
    TimeZone timezone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar cal = Calendar.getInstance(timezone);
}

From source file:JapaneseCalendar.java

public static void main(String args[]) {
    Locale locale = new Locale("ja", "JP", "JP");
    Calendar now = Calendar.getInstance(locale);

    Map<String, Integer> names = now.getDisplayNames(Calendar.ERA, Calendar.LONG, locale);
    System.out.printf("%s%n", names);
    System.out.printf("It is year %tY of the current era%n", now);
    System.out.printf("The calendar class is: %s%n", now.getClass().getName());
}

From source file:DaysOfTheWeek.java

public static void main(String argv[]) {
    Locale usersLocale = Locale.getDefault();

    DateFormatSymbols dfs = new DateFormatSymbols(usersLocale);
    String weekdays[] = dfs.getWeekdays();

    Calendar cal = Calendar.getInstance(usersLocale);

    int firstDayOfWeek = cal.getFirstDayOfWeek();
    int dayOfWeek;

    for (dayOfWeek = firstDayOfWeek; dayOfWeek < weekdays.length; dayOfWeek++)
        System.out.println(weekdays[dayOfWeek]);

    for (dayOfWeek = 0; dayOfWeek < firstDayOfWeek; dayOfWeek++)
        System.out.println(weekdays[dayOfWeek]);
}

From source file:JapaneseCalendar.java

public static void main(String[] args) {
    Locale japanese = new Locale("ja", "JP", "JP");

    Calendar cal = Calendar.getInstance(japanese);
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, japanese);
    String str = df.format(cal.getTime());

    JOptionPane.showMessageDialog(null, str);
}

From source file:com.easybanking.data.tester.java

/**
 * @param args the command line arguments
 *//*from  w  w w.  j a  v a 2s.  com*/
public static void main(String[] args) {
    // TODO code application logic here

    String pass = "123";
    String newPass = encriptPassword(pass);
    Bank bank = new Bank();
    bank.setId(1);
    System.out.println(newPass);

    BankBean bb = new BankBean();
    LoginBean lb = new LoginBean();
    lb.setSelectedBank(bank);
    BankData bd = new BankData();
    ArrayList<Person> resultList = bd.getListOfPersons(lb.getSelectedBank());

    BankAccountData bad = new BankAccountData();
    Client p = new Client();
    p.setId("456");
    p.setName("CARLOS");
    p.setLastName("Soto");
    p.setLastName2("soto");
    p.setEmail("wefd@DSF");
    p.setAddress("asdqw");
    p.setBirthDate(Calendar.getInstance(Locale.ENGLISH));
    p.setPhone("1234");

    PersonData pd = new PersonData();
    boolean insert = pd.create(p);

    System.out.println("" + insert);

    for (BankAccount ba : bad.getListOfAccounts(bank, p)) {

        System.out.println("" + ba.getId());

    }
    bb.loadTable();
}

From source file:Main.java

public static Calendar getNowTime() {
    return Calendar.getInstance(Locale.TAIWAN);
}

From source file:Main.java

public static String getStringTime() {
    Calendar c = Calendar.getInstance(Locale.ITALY);
    return c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE) + ":" + c.get(Calendar.SECOND);
}

From source file:Main.java

public static String getSeqWeek() {
    Calendar c = Calendar.getInstance(Locale.CHINA);
    String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
    if (week.length() == 1)
        week = "0" + week;
    String year = Integer.toString(c.get(Calendar.YEAR));
    return year + week;
}