Example usage for org.joda.time DateTimeZone forID

List of usage examples for org.joda.time DateTimeZone forID

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone forID.

Prototype

@FromString
public static DateTimeZone forID(String id) 

Source Link

Document

Gets a time zone instance for the specified time zone id.

Usage

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method to get aged date time./*from   ww  w . j  av  a 2 s.  com*/
 *
 * @param numberOfDays
 *            (number of days to age)
 * @return agedDateTime
 */
public DateTime getAgedDateTime(final int numberOfDays) {
    DateTimeZone californiaTimeZone = DateTimeZone.forID(this.propertyUtil.getProperty("environment.timezone"));
    DateTime agedDateTime = this.getGMTDateTime().plusDays(numberOfDays);
    agedDateTime = new DateTime(agedDateTime, californiaTimeZone);
    return agedDateTime;
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method used to get current date and time.
 *
 * @return currentDate (current date and time)
 */// www.j  a v  a2 s .co  m
public DateTime getDateTime() {
    DateTimeZone californiaTimeZone = DateTimeZone.forID(this.propertyUtil.getProperty("environment.timezone"));
    DateTime currentDate = new DateTime(this.getGMTDateTime(), californiaTimeZone);
    return currentDate;
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method to get GMT date time./* w  w w .j  av a 2  s . c om*/
 *
 * @return gmtDateTime
 */
public DateTime getGMTDateTime() {
    DateTimeZone gmtTimeZone = DateTimeZone.forID("GMT");
    DateTime gmtDateTime = new DateTime(gmtTimeZone);
    return gmtDateTime;
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method to get GMT date time.//from   ww  w  . j  a v  a2  s  .  com
 *
 * @param dateTime
 *            (date time to convert to GMT date time)
 * @return gmtDateTime
 */
public DateTime getGMTDateTime(final DateTime dateTime) {
    DateTimeZone gmtTimeZone = DateTimeZone.forID("GMT");
    DateTime gmtDateTime = new DateTime(dateTime, gmtTimeZone);
    return gmtDateTime;
}

From source file:com.citruspay.JDateUtil.java

License:Open Source License

public static DateTime getDateAndTime(Date date) {
    DateTimeZone ISTTimeZone = DateTimeZone.forID(UTC);
    DateTime dateTime = new DateTime(date.getTime(), ISTTimeZone);
    return dateTime;
}

From source file:com.citruspay.JDateUtil.java

License:Open Source License

@SuppressWarnings("deprecation")
public static DateTime getDateAndTime(String dailySettlementHr, String dailySettlementMin) {

    Date date = new Date();
    date.setHours((dailySettlementHr.length() < 2) ? Integer.valueOf("0" + dailySettlementHr)
            : Integer.valueOf(dailySettlementHr));
    date.setMinutes((dailySettlementMin.length() < 2) ? Integer.valueOf("0" + dailySettlementMin)
            : Integer.valueOf(dailySettlementMin));
    DateTimeZone ISTTimeZone = DateTimeZone.forID(UTC);
    System.out.println(" isttimezone=" + ISTTimeZone);
    DateTime dateTime = new DateTime(date.getTime(), ISTTimeZone);
    System.out.println(" dateTime=" + dateTime + "date=" + date + "date.getTime()=" + date.getTime());

    return dateTime;
}

From source file:com.citruspay.JDateUtil.java

License:Open Source License

public static Interval getISTPreviousDay() {
    DateTimeZone ISTTimeZone = DateTimeZone.forID(Asia_Kolkata);
    DateTime dateTime = new DateTime(ISTTimeZone);
    DateTime from = JDateUtil.startOfDay(dateTime.minusDays(1));
    DateTime to = JDateUtil.startOfDay(dateTime);
    return new Interval(from, to);
}

From source file:com.cloudera.gertrude.deploy.AvroSupport.java

License:Open Source License

public AvroSupport(boolean skipValidation, ConditionFactorySupport conditionFactorySupport,
        ExperimentFlagSupport experimentFlagSupport) {
    this.skipValidation = skipValidation;
    this.conditionFactorySupport = conditionFactorySupport;
    this.experimentFlagSupport = experimentFlagSupport;
    DateTimeZone.setDefault(DateTimeZone.forID(timeZoneId));
}

From source file:com.coderoad.automation.common.util.DateUtil.java

License:Open Source License

/**
 * Gets the calendar.// w w w .jav a 2  s  .  c  om
 * 
 * @param dateTime the date time
 * @param pattern the pattern
 * @param timeZone the time zone
 * @return the calendar
 * @throws ParseException the parse exception
 */
public static Calendar getCalendar(String dateTime, final String pattern, String timeZone)
        throws ParseException {

    DateTime dt = new DateTime(DateTimeZone.forID(timeZone));
    Calendar calendar = dt.toCalendar(Locale.ENGLISH);
    SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.ENGLISH);
    Date date = sdf.parse(dateTime);
    calendar.setTime(date);
    return calendar;
}

From source file:com.coderoad.automation.common.util.DateUtil.java

License:Open Source License

/**
 * Gets the calendar for time zone.//from   ww  w .  ja  va  2s  . c o m
 * 
 * @param timeZone the time zone
 * @return the calendar for time zone
 * @throws ParseException the parse exception
 */
public static Calendar getCalendarForTimeZone(final String timeZone) throws ParseException {

    DateTime dateTime = new DateTime(DateTimeZone.forID(timeZone));
    Calendar tzCalendar = dateTime.toCalendar(Locale.ENGLISH);
    return tzCalendar;
}