I would like to get the year of the current date, but this is not
working :
int year = Calendar.getInstance().get(Calendar.YEAR);
How to use date in gwt ?
Thanks in advance for your answer
:)
this is marked as deprecated and it's not the good value, that's not
2010.
I would rather use a non-deprecated method.
On Mar 19, 9:47 am, tim <timor.su...@gmail.com> wrote:
> Thanks for your answer.
>
> this is marked as deprecated and it's not the good value, that's not
> 2010.
int year = 1900 + new Date().getYear();
> I would rather use a non-deprecated method.
A future version of GWT (that's already in trunk, just not yet
released) will have a JsDate class to wrap the native JavaScript Date.
It'd be a GWT-specific API but at least it won't be deprecated if
that's really bothering you.
In reality, the "deprecated" Date object is simply used as an
interface, as GWT just uses it to wrap the JS date class calls
anyway. So, besides the annoying warnings which can easily be turned
off, why write a new GWT specific API to do the same wrapping? Seems
it would be better to write a real correctly working Calendar class
for those few apps that actually need the advanced functionality.
For my app I've actually had to write very correct calendars that span
all of time (15BY, not 6000YA...), including functions like the roll
and getting the number of days in a given month/year like Java's
class. With Gregorian/Julian/Proleptic/Astronomic versions it turns
into about 10k of compiled js. Unfortunately it's probably too
detailed to push out as the open source general calendar solution for
GWT..