Example usage for org.joda.time DateTime getMonthOfYear

List of usage examples for org.joda.time DateTime getMonthOfYear

Introduction

In this page you can find the example usage for org.joda.time DateTime getMonthOfYear.

Prototype

public int getMonthOfYear() 

Source Link

Document

Get the month of year field value.

Usage

From source file:adwords.axis.v201502.advancedoperations.AddAdCustomizer.java

License:Open Source License

/**
 * Creates FeedItems with the values to use in ad customizations for each ad group in
 * <code>adGroupIds</code>./*  w  w  w .j a  v a2 s  . co m*/
 */
private static void createCustomizerFeedItems(AdWordsServices adWordsServices, AdWordsSession session,
        List<Long> adGroupIds, AdCustomizerFeed adCustomizerFeed) throws Exception {
    // Get the FeedItemService.
    FeedItemServiceInterface feedItemService = adWordsServices.get(session, FeedItemServiceInterface.class);

    List<FeedItemOperation> feedItemOperations = Lists.newArrayList();

    DateTime now = new DateTime();

    DateTime marsDate = new DateTime(now.getYear(), now.getMonthOfYear(), 1, 0, 0);
    feedItemOperations.add(createFeedItemAddOperation("Mars", "$1234.56", marsDate.toString("yyyyMMdd HHmmss"),
            adGroupIds.get(0), adCustomizerFeed));

    DateTime venusDate = new DateTime(now.getYear(), now.getMonthOfYear(), 15, 0, 0);
    feedItemOperations.add(createFeedItemAddOperation("Venus", "$1450.00",
            venusDate.toString("yyyyMMdd HHmmss"), adGroupIds.get(1), adCustomizerFeed));

    FeedItemReturnValue feedItemReturnValue = feedItemService
            .mutate(feedItemOperations.toArray(new FeedItemOperation[feedItemOperations.size()]));

    for (FeedItem addedFeedItem : feedItemReturnValue.getValue()) {
        System.out.printf("Added feed item with ID %d.%n", addedFeedItem.getFeedItemId());
    }
}

From source file:aplicacion.control.AsignarHorasExtrasController.java

void addDaysColumns(int count) {
    DateTime fecha = new DateTime(inicio.getTime());
    fecha = fecha.plusDays(count);//from   ww  w . ja v  a2  s.  c om
    String day = fecha.toCalendar(Locale.getDefault()).getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
            Locale.getDefault());
    TableColumn columna = new TableColumn(day + " " + fecha.getDayOfMonth() + "/" + fecha.getMonthOfYear());
    columna.setPrefWidth(120);
    columna.setStyle("-fx-alignment: center;");
    columna.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<EmpleadoTable, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(TableColumn.CellDataFeatures<EmpleadoTable, String> data) {

                    if (data.getValue().getExtras() == null)
                        return null;

                    return new ReadOnlyStringWrapper(getTextHorario(data.getValue().getExtras().get(count)));
                }
            });
    empleadosTableView.getColumns().add(columna);
}

From source file:aplicacion.control.EmpleadoController.java

public void setEmpleado(Usuario empleado) throws IOException, SQLException {
    this.empleado = empleado;
    nombre.setText(empleado.getNombre() + " " + empleado.getApellido());
    cedula.setText(empleado.getCedula());
    telefono.setText(empleado.getTelefono());
    direccion.setText(empleado.getDireccion());
    email.setText(empleado.getEmail());//from   w ww.ja  va2 s  .co m
    estadoCivil.setText(empleado.getEstadoCivil().getNombre());
    empresa.setText(empleado.getDetallesEmpleado().getEmpresa().getNombre());
    departamento.setText(empleado.getDetallesEmpleado().getDepartamento().getNombre());
    cargo.setText(empleado.getDetallesEmpleado().getCargo().getNombre());
    cuenta.setText(empleado.getDetallesEmpleado().getNroCuenta());
    sueldo.setText("$" + empleado.getDetallesEmpleado().getSueldo());
    extra.setText(empleado.getDetallesEmpleado().getExtra());
    DateTime inicio = new DateTime(empleado.getDetallesEmpleado().getFechaInicio().getTime());
    fechaInicio.setText(
            inicio.getDayOfMonth() + " de " + getMonthName(inicio.getMonthOfYear()) + " " + inicio.getYear());
    DateTime contrato = new DateTime(empleado.getDetallesEmpleado().getFechaContrato().getTime());
    fechaContrato.setText(contrato.getDayOfMonth() + " de " + getMonthName(contrato.getMonthOfYear()) + " "
            + contrato.getYear());
    DateTime nacimiento = new DateTime(empleado.getNacimiento().getTime());
    cumpleano.setText(nacimiento.getDayOfMonth() + " de " + getMonthName(nacimiento.getMonthOfYear()) + " "
            + nacimiento.getYear());

    Foto foto = new FotoDAO().findByEmpleadoId(empleado.getId());

    if (foto != null && foto.getFoto() != null) {
        final BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(foto.getFoto()));
        Image image = SwingFXUtils.toFXImage(bufferedImage, null);
        setProfileImage(image);
    }
}

From source file:aplicacion.control.HorarioEmpleadoController.java

public static LocalDate getDateFromTimestamp(Timestamp timestamp) {
    if (timestamp == null) {
        return null;
    } else {//from w  w  w . ja v a  2 s  .c  om
        DateTime dateTime = new DateTime(timestamp.getTime());
        return LocalDate.of(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth());
    }
}

From source file:aplicacion.control.util.Fechas.java

public static LocalDate getLocalFromTimestamp(Timestamp timestamp) {
    if (timestamp == null) {
        return null;
    } else {/*from   w ww . j a v  a 2  s.  c om*/
        DateTime dateTime = new DateTime(timestamp.getTime());
        return LocalDate.of(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth());
    }
}

From source file:aplicacion.control.util.Fechas.java

public static String getFechaConMes(DateTime dateTime) {
    String fecha = dateTime.getDayOfMonth() + " de " + getMonthName(dateTime.getMonthOfYear()) + " "
            + dateTime.getYear();//  w  w  w . jav a 2s.  c o  m
    return fecha;
}

From source file:aplicacion.control.util.Fechas.java

public static String getFechaConMesSinAno(DateTime dateTime) {
    String fecha = dateTime.getDayOfMonth() + " de " + getMonthName(dateTime.getMonthOfYear());
    return fecha;
}

From source file:aplicacion.control.util.Fechas.java

public static String getFechaConMes(Date date) {
    DateTime dateTime = new DateTime(date.getTime());
    String fecha = dateTime.getDayOfMonth() + " de " + getMonthName(dateTime.getMonthOfYear()) + " "
            + dateTime.getYear();/*from   w w w  . ja v a2s .  c  om*/
    return fecha;
}

From source file:aplicacion.control.util.Fechas.java

public static String getFechaConMes(Timestamp timestamp) {
    DateTime dateTime = new DateTime(timestamp.getTime());
    String fecha = dateTime.getDayOfMonth() + " de " + getMonthName(dateTime.getMonthOfYear()) + " "
            + dateTime.getYear();//w  w w.j  ava  2  s . c o m
    return fecha;
}

From source file:aplicacion.control.util.Fechas.java

public static String getFechaConMesYHora(DateTime dateTime) {
    String fecha = dateTime.getDayOfMonth() + " de " + getMonthName(dateTime.getMonthOfYear()) + " "
            + dateTime.getYear() + " a las " + dateTime.toString("HH:mm:ss");
    return fecha;
}