🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #642

Re: Crear fechas especificas

#642
From: Ricardo Palomares Martinez
Date: Sun, 14 Jan 2007 22:15
26 lines
1657 bytes
Carles Company Soler escribió:
> Cómo puedo crear un objeto Date de una fecha especifica? Si uso la creadora
> Date(año, mes, dia) me dice que està deprecated.


La documentación de la API recomienda usar Calendar.set(int year, int
month, int day) seguido de (aunque esto no lo dice explícitamente)
Calendar.getTime(). Algo así:

GregorianCalendar dummy = new GregorianCalendar();
Date miFecha;

dummy.set(2007, 0, 14); // Meses contando desde 0; Enero = 0
miFecha = dummy.getTime();

Prueba a ver si así te funciona. Esta complicación se debe al molesto
hecho de que Java es multiplataforma y, por ello, tiene en cuenta que
no todo el mundo sigue el calendario gregoriano. :-)

Saludos.

-- 
If it's true that we are here to help others,
then what exactly are the OTHERS here for?
Technical Details
Message-ID: <dkmq74-hhc.ln1@Father.family>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!aioe.org!Father.family!news
References: <eodbbs$lh8$1@negre.bartolo>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1116f3,7288675469132329
X-Google-Attributes: gid1116f3,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!aioe.org!Father.family!news
From: Ricardo Palomares Martinez <rpm.PUBLI@iespana.es>
Newsgroups: es.comp.lenguajes.java
Subject: Re: Crear fechas especificas
Date: Sun, 14 Jan 2007 23:15:09 +0100
Organization: Hogar, dulce hogar
Lines: 26
Message-ID: <dkmq74-hhc.ln1@Father.family>
References: <eodbbs$lh8$1@negre.bartolo>
NNTP-Posting-Host: PchjwA9a4t7amoVesVliRg.user.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.1.2pre) Gecko/20061223 SeaMonkey/1.1 Mnenhy/0.7.4.0