Example usage for java.text DateFormat getDateInstance

List of usage examples for java.text DateFormat getDateInstance

Introduction

In this page you can find the example usage for java.text DateFormat getDateInstance.

Prototype

public static final DateFormat getDateInstance(int style) 

Source Link

Document

Gets the date formatter with the given formatting style for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:org.openregistry.core.service.DefaultPersonServiceIntegrationTests.java

/**
  * Test 2: Test of adding two new SoR Persons to an empty database (with no matches):
  * Expectations: 2 Sor Person rows/*from w ww .  ja va 2 s. co  m*/
  *               2 Calculated persons, two names, two identifiers
  */
@Test
public void testAddTwoDifferentPeople() throws ReconciliationException, SorPersonAlreadyExistsException {
    final ReconciliationCriteria reconciliationCriteria1 = constructReconciliationCriteria(RUDYARD, KIPLING,
            null, EMAIL_ADDRESS, PHONE_NUMBER, new Date(0), OR_WEBAPP_IDENTIFIER, null);
    final ServiceExecutionResult<Person> result1 = this.personService.addPerson(reconciliationCriteria1);

    final ReconciliationCriteria reconciliationCriteria2 = constructReconciliationCriteria("Foo", "Bar", null,
            "la@lao.com", "9085550987", new Date(0), OR_WEBAPP_IDENTIFIER, null);
    final ServiceExecutionResult<Person> result2 = this.personService.addPerson(reconciliationCriteria2);

    assertTrue(result2.succeeded());
    assertNotNull(result2.getTargetObject().getId());
    assertEquals(2, countRowsInTable("prc_persons"));
    assertEquals(2, countRowsInTable("prc_names"));
    assertEquals(2, countRowsInTable("prs_names"));
    assertEquals(2, countRowsInTable("prs_sor_persons"));

    final Person person2 = result2.getTargetObject();
    final SorPerson sorPerson2 = this.personService.findByPersonIdAndSorIdentifier(person2.getId(),
            OR_WEBAPP_IDENTIFIER);

    final Person person1 = result1.getTargetObject();
    final SorPerson sorPerson1 = this.personService.findByPersonIdAndSorIdentifier(person1.getId(),
            OR_WEBAPP_IDENTIFIER);

    // check birthdate is set correctly
    Date birthDate1 = this.simpleJdbcTemplate
            .queryForObject("select date_of_birth from prc_persons where id = ?", Date.class, person1.getId());
    DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT);
    assertEquals(formatter.format(birthDate1), formatter.format(person1.getDateOfBirth()));

    Date birthDate2 = this.simpleJdbcTemplate
            .queryForObject("select date_of_birth from prc_persons where id = ?", Date.class, person2.getId());
    assertEquals(formatter.format(birthDate2), formatter.format(person2.getDateOfBirth()));

    // check SOR source is set correctly
    String sourceSor1 = this.simpleJdbcTemplate.queryForObject(
            "select source_sor_id from prs_sor_persons where person_id = ?", String.class, person1.getId());
    assertEquals(sourceSor1, sorPerson1.getSourceSor());

    String sourceSor2 = this.simpleJdbcTemplate.queryForObject(
            "select source_sor_id from prs_sor_persons where person_id = ?", String.class, person2.getId());
    assertEquals(sourceSor2, sorPerson2.getSourceSor());

    // check names in prc_names
    String familyName1 = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prc_names where person_id = ?", String.class, person1.getId());
    assertEquals(familyName1, KIPLING);

    String familyName2 = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prc_names where person_id = ?", String.class, person2.getId());
    assertEquals(familyName2, "Bar");

    String givenName1 = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prc_names where person_id = ?", String.class, person1.getId());
    assertEquals(givenName1, RUDYARD);

    String givenName2 = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prc_names where person_id = ?", String.class, person2.getId());
    assertEquals(givenName2, "Foo");

    // check names in prs_names
    String prsFamilyName1 = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prs_names where sor_person_id = ?", String.class, sorPerson1.getId());
    assertEquals(prsFamilyName1, KIPLING);

    String prsGivenName1 = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prs_names where sor_person_id = ?", String.class, sorPerson1.getId());
    assertEquals(prsGivenName1, RUDYARD);

    String prsFamilyName2 = this.simpleJdbcTemplate.queryForObject(
            "select family_name from prs_names where sor_person_id = ?", String.class, sorPerson2.getId());
    assertEquals(prsFamilyName2, "Bar");

    String prsGivenName2 = this.simpleJdbcTemplate.queryForObject(
            "select given_name from prs_names where sor_person_id = ?", String.class, sorPerson2.getId());
    assertEquals(prsGivenName2, "Foo");

}

From source file:com.example.styleddialog.MyActivity.java

@Override
public void onNegativeButtonClicked(int resultCode, Date date) {
    String text = "";
    if (resultCode == 12) {
        text = "Date ";
    } else if (resultCode == 13) {
        text = "Time ";
    }/*from   ww  w. j ava 2 s  .  co m*/

    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT);
    Toast.makeText(this, text + "Cancelled " + dateFormat.format(date), Toast.LENGTH_SHORT).show();
}

From source file:fit.Fixture.java

public Object parse(String s, Class<?> type) throws Exception {
    if (type.equals(String.class)) {
        if (s.toLowerCase().equals("null"))
            return null;
        else if (s.toLowerCase().equals("blank"))
            return "";
        else/*from w  w  w.  ja va 2 s  .  co m*/
            return s;
    } else if (type.equals(Date.class)) {
        return DateFormat.getDateInstance(DateFormat.SHORT).parse(s);
    } else if (hasParseMethod(type)) {
        return callParseMethod(type, s);
    } else {
        throw new CouldNotParseFitFailureException(s, type.getName());
    }
}

From source file:org.carewebframework.common.DateUtil.java

/**
 * Attempts to parse a string containing a date representation using several different date
 * patterns./*www . j a  va  2  s.  c o  m*/
 * 
 * @param value String to parse
 * @return If the parsing was successful, returns the date value represented by the input value.
 *         Otherwise, returns null.
 */
private static Date tryParse(String value) {
    for (Format format : Format.values()) {
        try {
            return format.parse(value);
        } catch (Exception e) {
        }
    }

    for (int i = 3; i >= 0; i--) {
        try {
            return DateFormat.getDateInstance(i).parse(value);
        } catch (Exception e) {
        }
    }

    return null;
}

From source file:com.pos.spatobiz.app.view.karyawan.UbahKaryawan.java

/** This method is called from within the constructor to
 * initialize the form./*from ww w. j  ava  2 s. co  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jeniskelamin = new ButtonGroup();
    labelKode = new WhiteLabel();
    labelNama = new WhiteLabel();
    labelTanggalLahir = new WhiteLabel();
    labelAlamat = new WhiteLabel();
    textKode = new TextBoxTransfer();
    textNama = new TextBoxTransfer();
    textTanggalLahir = new DateBox();
    textAlamat = new WhiteTextArea();
    errorKode = new RedLabel();
    errorNama = new RedLabel();
    errorTanggalLahir = new RedLabel();
    errorAlamat = new RedLabel();
    textTelepon = new TextBoxTransfer();
    labelTelepon = new WhiteLabel();
    labelEmail = new WhiteLabel();
    labelJenisKelamin = new WhiteLabel();
    labelPhoto = new WhiteLabel();
    textEmail = new TextBoxTransfer();
    radioPria = new JRadioButton();
    radioWanita = new JRadioButton();
    errorTelepon = new RedLabel();
    errorEmail = new RedLabel();
    imageChooser = new ImageChooser();
    buttonBatal = new Button();
    buttonUbah = new Button();
    buttonCari = new Button();

    setBackground(new Color(0, 0, 0));

    labelKode.setHorizontalAlignment(SwingConstants.RIGHT);
    labelKode.setText("Kode :");

    labelNama.setHorizontalAlignment(SwingConstants.RIGHT);
    labelNama.setText("Nama :");

    labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTanggalLahir.setText("Tanggal Lahir :");

    labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT);
    labelAlamat.setText("Alamat :");

    textTanggalLahir.setFormatterFactory(
            new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG))));
    textTanggalLahir.setPreferredSize(new Dimension(120, 24));
    textTanggalLahir.setValue(new Date());

    errorKode.setText("error kode");

    errorNama.setText("error nama");

    errorTanggalLahir.setText("error tanggal lahir");

    errorAlamat.setText("error alamat");

    labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT);
    labelTelepon.setText("Telepon :");

    labelEmail.setHorizontalAlignment(SwingConstants.RIGHT);
    labelEmail.setText("Email :");

    labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT);
    labelJenisKelamin.setText("Jenis Kelamin :");

    labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT);
    labelPhoto.setText("Photo :");

    jeniskelamin.add(radioPria);
    radioPria.setFont(new Font("Tahoma", 1, 11));
    radioPria.setForeground(new Color(255, 255, 255));
    radioPria.setSelected(true);
    radioPria.setText("Pria");
    radioPria.setOpaque(false);

    jeniskelamin.add(radioWanita);
    radioWanita.setFont(new Font("Tahoma", 1, 11));
    radioWanita.setForeground(new Color(255, 255, 255));
    radioWanita.setText("Wanita");
    radioWanita.setOpaque(false);

    errorTelepon.setText("error telepon");

    errorEmail.setText("error email");

    buttonBatal.setMnemonic('B');
    buttonBatal.setText("Batal");

    buttonUbah.setMnemonic('U');
    buttonUbah.setText("Ubah");

    buttonCari.setText("Cari");

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelPhoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelJenisKelamin, Alignment.LEADING,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelTelepon, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelTanggalLahir, Alignment.LEADING,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(textAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403,
                                            Short.MAX_VALUE)
                                    .addComponent(textNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403,
                                            Short.MAX_VALUE)
                                    .addComponent(textTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            403, Short.MAX_VALUE)
                                    .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                                    .addGroup(Alignment.LEADING,
                                            layout.createSequentialGroup().addComponent(radioPria)
                                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                                    .addComponent(radioWanita))
                                    .addComponent(imageChooser, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                            253, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(textEmail, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                                    .addGroup(layout.createSequentialGroup()
                                            .addComponent(textKode, GroupLayout.DEFAULT_SIZE, 339,
                                                    Short.MAX_VALUE)
                                            .addPreferredGap(ComponentPlacement.UNRELATED)
                                            .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                            .addGap(4, 4, 4)
                            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(errorKode, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorNama, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(buttonUbah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonBatal,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)))
            .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(radioPria).addComponent(radioWanita))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonUbah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));
}

From source file:org.lunarray.model.descriptor.util.DateFormatUtil.java

/**
 * Resolves the date format.//from ww  w  .  jav  a 2s . com
 * 
 * @param locale
 *            The (optional) locale.
 * @return The format.
 */
private DateFormat resolveDateFormat(final Locale locale) {
    DateFormat defaultValue;
    if (CheckUtil.isNull(locale)) {
        defaultValue = DateFormat.getDateInstance(DateFormat.FULL);
    } else {
        defaultValue = DateFormat.getDateInstance(DateFormat.FULL, locale);
    }
    return this.resolve(DateFormatUtil.DEFAULT_DATE_KEY, defaultValue, locale);
}

From source file:org.kalypso.model.wspm.tuhh.core.wprof.BCEShapeWPRofContentProvider.java

@Override
public String getProfileComment() {
    final Date date = getDate();
    final String dateText = date == null ? "-" : DateFormat.getDateInstance(DateFormat.MEDIUM).format(date); //$NON-NLS-1$

    final String pnam = getPNam();

    final StringBuilder builder = new StringBuilder();
    builder.append(String.format("Gew-ID: %s%nProfilname: %s%nErster Punkt: %s%nErster Obj_Typ: %s%n", //$NON-NLS-1$
            getRiverId(), pnam, getComment(), getObjectType()));
    builder.append(String.format("Aufgenommen am: %s", dateText)); //$NON-NLS-1$

    final String pdfUrl = getPdfUrl();
    if (pdfUrl != null) {
        builder.append(String.format("%nPDF: %s ", pdfUrl)); //$NON-NLS-1$
    }/*from   w  w w. j  ava 2  s  .  c o  m*/

    return builder.toString();
}

From source file:org.apache.wicket.protocol.http.mock.MockHttpServletRequest.java

/**
 * @param name//from  w ww.  jav a 2 s .co  m
 * @param date
 */
public void addDateHeader(String name, long date) {
    DateFormat df = DateFormat.getDateInstance(DateFormat.FULL);
    String dateString = df.format(new Date(date));
    addHeader(name, dateString);
}

From source file:org.nuxeo.ecm.webapp.edit.lock.LockActionsBean.java

@Override
public Map<String, Serializable> getLockDetails(DocumentModel document) {
    if (lockDetails == null || !StringUtils.equals(documentId, document.getId())) {
        lockDetails = new HashMap<String, Serializable>();
        documentId = document.getId();/*from  w  w w  .j  a  v a 2 s  .c  om*/
        Lock lock = documentManager.getLockInfo(document.getRef());
        if (lock == null) {
            return lockDetails;
        }
        lockDetails.put(LOCKER, lock.getOwner());
        lockDetails.put(LOCK_CREATED, lock.getCreated());
        lockDetails.put(LOCK_TIME, DateFormat.getDateInstance(DateFormat.MEDIUM)
                .format(new Date(lock.getCreated().getTimeInMillis())));
    }
    return lockDetails;
}

From source file:net.sourceforge.dvb.projectx.common.Common.java

/**
 * //from  w ww.  j a  v a 2s  . co m
 */
public static String getDateAndTime() {
    return (DateFormat.getDateInstance(DateFormat.LONG).format(new Date()) + "    "
            + DateFormat.getTimeInstance(DateFormat.LONG).format(new Date()));
}