[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] M3 DateTime control
|
- From: scolebourne@xxxxxxxx (Stephen Colebourne)
- Date: Mon, 13 Nov 2006 13:02:22 +0000 (UTC)
- Newsgroups: eclipse.platform.swt
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
Hi,
I read an article, http://www.eclipsezone.com/eclipse/forums/t83882.html,
about this control. Date and time is an area I am familiar with from
Joda-Time, http://joda-time.sourceforge.net, which has a complete
replacement for Date and Calendar.
The article included the following code sample:
DateTime dt = new DateTime(parent, SWT.DATE); // or SWT.TIME if desired
int day = dt.getDay(); // Calendar.DAY_OF_MONTH
int hour = dt.getHours(); // Calendar.HOUR_OF_DAY
int min = dt.getMinutes(); // Calendar.MINUTE
int month = dt.getMonth(); // Calendar.MONTH
int second = dt.getSeconds(); // Calendar.SECOND
int year = dt.getYear(); // Calendar.YEAR
I was wondering if you would consider changing the API method names to
match those used in Joda-Time, which were selected for utmost clarity:
DateTime dt = new DateTime(parent, SWT.DATE); // or SWT.TIME if desired
int day = dt.getDayOfMonth(); // Calendar.DAY_OF_MONTH
int hour = dt.getHourOfDay(); // Calendar.HOUR_OF_DAY
int min = dt.getMinuteOfHour(); // Calendar.MINUTE
int month = dt.getMonthOfYear(); // Calendar.MONTH
int second = dt.getSecondOfMinute(); // Calendar.SECOND
int year = dt.getYear(); // Calendar.YEAR
This might open up the potential for the control to implement the
Joda-Time ReadableDateTime interface (either by yourselves or a third
party) enabling even greater integration.
thanks
Stephen