From: pbarros Date: Wed, 11 Jan 2012 14:13:25 +0000 (-0200) Subject: Classe Utilitaria para converter data SQL X-Git-Url: http://200.18.67.61/gitweb/?a=commitdiff_plain;h=82425a195b7b0de298202a69c0cd98fd15805485;p=simdecs.git Classe Utilitaria para converter data SQL --- diff --git a/src/java/org/ufcspa/simdecs/util/UtilitarioSql.java b/src/java/org/ufcspa/simdecs/util/UtilitarioSql.java new file mode 100644 index 0000000..bb4d35c --- /dev/null +++ b/src/java/org/ufcspa/simdecs/util/UtilitarioSql.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.ufcspa.simdecs.util; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * + * @author pbarros + */ +public class UtilitarioSql { + + + public void UtilitarioSql() + { + } + + public java.sql.Date converteDataUtilToSql(Date data) { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + Date dataUtil = data; + java.sql.Date dataSql = null; + try { + dataUtil = new java.sql.Date(dataUtil.getTime()); + dataSql = (java.sql.Date) dataUtil; + + } catch (Exception e) { + //JOptionPane.showMessageDialog(null, "Erro ao converte data para sql: " + e.getMessage()); + } + return dataSql; + } + +}