Example usage for org.joda.time DateTime toGregorianCalendar

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

Introduction

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

Prototype

public GregorianCalendar toGregorianCalendar() 

Source Link

Document

Get the date time as a java.util.GregorianCalendar, assigning exactly the same millisecond instant.

Usage

From source file:org.springframework.ws.samples.airline.schema.support.SchemaConversionUtils.java

License:Apache License

public static XMLGregorianCalendar toXMLGregorianCalendar(DateTime dateTime)
        throws DatatypeConfigurationException {
    DatatypeFactory factory = DatatypeFactory.newInstance();
    return factory.newXMLGregorianCalendar(dateTime.toGregorianCalendar());
}

From source file:prototypes.ws.proxy.soap.commons.time.Dates.java

License:Apache License

public static Calendar parseToCalendar(String cal, String pattern) {
    DateTime dt = DateTime.parse(cal, DateTimeFormat.forPattern(pattern));
    return dt.toGregorianCalendar();
}

From source file:sor.galeriaarte.VentanaEdicion.java

private void btGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btGuardarActionPerformed

    if (!"".equals(tbHora.getText()) && !"".equals(tbMinuto.getText())) {
        if (Integer.parseInt(tbHora.getText()) < 24 && Integer.parseInt(tbHora.getText()) >= 0) {
            if (Integer.parseInt(tbMinuto.getText()) < 60 && Integer.parseInt(tbMinuto.getText()) >= 0) {
                if (Integer.parseInt(tbDia.getText()) > 0 && Integer.parseInt(tbDia.getText()) <= 31) {
                    if (Integer.parseInt(tbMes.getText()) > 0 && Integer.parseInt(tbMes.getText()) <= 12) {
                        DateTime date = new DateTime(Integer.parseInt(tbAnyo.getText()),
                                Integer.parseInt(tbMes.getText()), Integer.parseInt(tbDia.getText()),
                                Integer.parseInt(tbHora.getText()), Integer.parseInt(tbMinuto.getText()), 0);

                        if (date.compareTo(DateTime.now()) > 0) {
                            try {
                                URL u = new URL(new Juddi().getServiceUrl("Ventas"));
                                Ventas serv = new Ventas(u);
                                Gson gson = new GsonBuilder().create();
                                XMLGregorianCalendar xgc = DatatypeFactory.newInstance()
                                        .newXMLGregorianCalendar(date.toGregorianCalendar());
                                serv.getVentasSoap().editarVenta(ventaId, xgc);
                                this.setVisible(false);
                                this.dispose();
                            } catch (MalformedURLException ex) {
                                Logger.getLogger(VentanaEdicion.class.getName()).log(Level.SEVERE, null, ex);
                            } catch (DatatypeConfigurationException ex) {
                                Logger.getLogger(VentanaEdicion.class.getName()).log(Level.SEVERE, null, ex);
                            }/*from  w w  w .j  a  v a  2 s .  co  m*/
                        }
                    }
                }
            }
        }
    }
}