I am having set of 8 images. Here the images will be flipping according to the time which is set by the user and their will be default wake up time 7:00am. If the user sets the time at 10:10pm and the wake up time is 7:00am. Now, the images needs to flip and the flipping of images are in percentage wise i.e; 0% 20% 40% 60% 80% 90% 95% 100% of the total time. Now, the images are flipping when i am setting the time from 10:00am to 7:00pm , 9:00am to 11:00am , 7:00pm to 8:30pm etc. But when i am setting from 10:00pm to 7:00am the images are not flipping.
c = Calendar.getInstance();
SimpleDateFormat displayFormat = new SimpleDateFormat("HH:mm");
SimpleDateFormat testhrFormat = new SimpleDateFormat("HH");
SimpleDateFormat testminFormat = new SimpleDateFormat("mm");
String formattedDate = testhrFormat.format(c.getTime());
int minDate = Integer.parseInt(testminFormat.format(c.getTime()));
long hrlong = TimeUnit.HOURS.toMinutes(Long.parseLong(formattedDate));
addedmin = hrlong + minDate;
twwntyhrformat = displayFormat.format(c.getTime());
SimpleDateFormat parseFormat = new SimpleDateFormat("HH:mm a");
SharedPreferences timegot = getSharedPreferences("CHILDTIME", MODE_PRIVATE);
String time = timegot.getString("savedwakeuptime", "");
try {
Date date = parseFormat.parse(time);
String gottime = displayFormat.format(date);
String[] timedivided = gottime.split(":");
String gothr = timedivided[0];
long gotlong = TimeUnit.HOURS.toMinutes(Long.parseLong(gothr));
String gotmin = timedivided[1];
int gotintmin = Integer.parseInt(gotmin);
addgottime = gotlong + gotintmin;
long subtime = addgottime - addedmin;
String submilli = String.valueOf(subtime);
long submillitimeunit = TimeUnit.MINUTES.toMillis(Long.parseLong(submilli));
final int gotflippingtime = (int) submillitimeunit;
handler = new Handler();
run = new Runnable() {
#Override
public void run() {
String number = String.valueOf(fliper.getDisplayedChild());
if (number.equals("7")) {
handler.removeCallbacks(run);
back_home.setEnabled(true);
} else {
fliper.showNext();
handler.postDelayed(run, gotflippingtime);
}
}
};
for (int gotinterval : gotintervals) {
handler.postDelayed(run, gotinterval);
}
handler.postDelayed(run, gotflippingtime);
} catch (ParseException e) {
e.printStackTrace();
}
} else {
c = Calendar.getInstance();
SimpleDateFormat testhrFormat = new SimpleDateFormat("HH");
SimpleDateFormat testminFormat = new SimpleDateFormat("mm");
String formattedDate = testhrFormat.format(c.getTime());
int minDate = Integer.parseInt(testminFormat.format(c.getTime()));
long hrlong = TimeUnit.HOURS.toMinutes(Long.parseLong(formattedDate));
addedmin = hrlong + minDate;
SharedPreferences timegot = getSharedPreferences("CHILDTIME", MODE_PRIVATE);
long numberlong = timegot.getLong("savedwakeuptime",0);
long millicurrenttime=TimeUnit.MINUTES.toMillis(addedmin);
long subtime = numberlong-millicurrenttime;
Log.d("Calc", String.valueOf(subtime)+" "+String.valueOf(numberlong)+" "+String.valueOf(millicurrenttime));
flippingtime = (int) subtime;
intervals = new ArrayList<Integer>();
intervals.add((int) (flippingtime * 0.20f));
intervals.add((int) (flippingtime * 0.40f));
intervals.add((int) (flippingtime * 0.60f));
intervals.add((int) (flippingtime * 0.80f));
intervals.add((int) (flippingtime * 0.90f));
intervals.add((int) (flippingtime * 0.95f));
intervals.add((int) (flippingtime * 1.00f));
intervals.add(flippingtime);
handler = new Handler();
run = new Runnable() {
#Override
public void run() {
String number = String.valueOf(fliper.getDisplayedChild());
if (number.equals("7")) {
handler.removeCallbacks(run);
} else {
fliper.showNext();
handler.postDelayed(run, flippingtime);
}
}
};
for (int interval : intervals) {
handler.postDelayed(run, interval);
}
handler.postDelayed(run, flippingtime);
Related
I am trying to add events dynamically from the my SQLite database , but i get a single event in my Week-view which it is the last event i add in the database , i am using Alamkanak Week-View , i stuck with problem and try many ways , please help guys .
mWeekView.setMonthChangeListener(new MonthLoader.MonthChangeListener() {
#Override
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
ArrayList<WeekViewEvent> lastevents = new ArrayList<WeekViewEvent>();
lastevents = loadDateFromJson(newYear,newMonth);
events.addAll(loadDateFromJson(newYear,newMonth));
return events;
}
} );
}
public ArrayList<WeekViewEvent> getmNewEvents(int year , int month ) {
// Parse time.
SimpleDateFormat sdf = new SimpleDateFormat("HH:MM");
Date start = new Date();
Date end = new Date();
start = getMyTime();
try {
end = sdf.parse(new Event().getEndTime());
} catch (ParseException e) {
e.printStackTrace();
}
Calendar now = Calendar.getInstance();
Calendar startTime = (Calendar) now.clone();
startTime.setTimeInMillis(start.getTime());
startTime.set(Calendar.YEAR, now.get(Calendar.YEAR));
startTime.set(Calendar.MONTH, now.get(Calendar.MONTH));
startTime.set(Calendar.DAY_OF_MONTH, getMyDate());
Calendar endTime = (Calendar) startTime.clone();
endTime.add(Calendar.HOUR_OF_DAY, 3);
// Create an week view event.
ArrayList<WeekViewEvent> ThisMonthsEvents = new ArrayList<WeekViewEvent>();
WeekViewEvent weekViewEvent =new WeekViewEvent(1,"Raouf",startTime,endTime);
mNewEvents.add(weekViewEvent);
for (int i = 0; i < mNewEvents.size(); i++) {
mNewEvents.get(i).getStartTime().get(Calendar.MONTH);
if((mNewEvents.get(i).getStartTime().get(Calendar.MONTH) == month)&&(mNewEvents.get(i).getStartTime().get(Calendar.YEAR) == year))
ThisMonthsEvents.add(mNewEvents.get(i));
}
ArrayList<WeekViewEvent> matchedEvents = new ArrayList<WeekViewEvent>();
for (WeekViewEvent event : mNewEvents) {
if (eventMatches(event, year, month)) {
matchedEvents.add(event);
}
}
mWeekView.notifyDatasetChanged();
return ThisMonthsEvents;
}
// here how i am getting dates from my SQlite Database
public int getMyDate() {
DBconexion db = new DBconexion(this);
SQLiteDatabase db2 = db.getReadableDatabase();
Cursor cur = db2.rawQuery("SELECT * FROM " + Table_name, null);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-mm-yyyy");
// looping through all rows and adding to list
String date = null;
Date Date = new Date();
ArrayList<String> dateStringList = new ArrayList<String>();
ArrayList<Date> dateList = new ArrayList<Date>();
int DayOfMonth = 0;
while (cur.moveToNext()) {
dateStringList.add(cur.getString(9));
}
for (String dateString : dateStringList) {
try {
dateList.add(simpleDateFormat.parse(dateString));
} catch (ParseException e) {
e.printStackTrace();
}
}
for (Date datee : dateList) {
DayOfMonth = datee.getDate();
}
return DayOfMonth;
}
i find how to solve this , i use JSONArrays and it works perfectly
here is the code maybe someone will need it!
public List<WeekViewEvent> loadDateFromJson(int year , int month) {
DBconexion dBconexion = new DBconexion(this);
#SuppressLint("SimpleDateFormat") SimpleDateFormat sdfD = new SimpleDateFormat("yy-MM-dd");
#SuppressLint("SimpleDateFormat") SimpleDateFormat sdfT = new SimpleDateFormat("HH:mm");
try {
JSONObject jo = dBconexion.getDateTime();
JSONArray Datejason = jo.getJSONArray("Date");
JSONArray Timejason = jo.getJSONArray("Time");
JSONArray endTimejason = jo.getJSONArray("End Time");
JSONArray Namejason = jo.getJSONArray("Name");
for (int i = 0; i < Datejason.length(); i++) {
//set date
String sd = (String) Datejason.get(i);
Date dfj = sdfD.parse(sd);
int Day = dfj.getDate();
int Month = dfj.getMonth() - 0;
int Year = dfj.getYear();
//set time
String st = (String) Timejason.get(i);
Date tfj = sdfT.parse(st);
int Hour = tfj.getHours();
int Minute = tfj.getMinutes();
String endTimeP = (String) endTimejason.getString(i);
int endTimePeriod = Integer.valueOf(endTimeP);
//set name
String Name = (String) Namejason.getString(i);
//Rand Colors for Events
Random rand = new Random();
int r = rand.nextInt(255);
int g = rand.nextInt(255);
int b = rand.nextInt(255);
int randomColor = Color.rgb(r,g,b);
if(Color.rgb(r,g,b) == getResources().getColor(R.color.white)){
randomColor = getResources().getColor(R.color.red);
}
//Set StarTime
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, Hour);
startTime.set(Calendar.MINUTE, Minute);
startTime.set(Calendar.YEAR, year);
startTime.set(Calendar.MONTH, Month);
startTime.set(Calendar.DAY_OF_MONTH, Day);
Calendar endTime = (Calendar) startTime.clone();
endTime.add(Calendar.HOUR_OF_DAY, endTimePeriod);
WeekViewEvent weekViewEvent = new WeekViewEvent(1, Name, startTime, endTime);
weekViewEvent.setColor(randomColor);
myEvent.add(weekViewEvent);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return myEvent;
}
onMonthChange will look like
mWeekView.setMonthChangeListener(new MonthLoader.MonthChangeListener() {
#Override
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
List<WeekViewEvent> lastone = new ArrayList<WeekViewEvent> ();
lastone = loadDateFromJson( newYear , newMonth);
events.addAll(lastone);
ArrayList<WeekViewEvent> matchedEvents = new ArrayList<WeekViewEvent>();
for (WeekViewEvent event : events) {
if (eventMatches(event, newYear, newMonth)) {
matchedEvents.add(event);
}
}
return matchedEvents;
}
} );
}
I have a problem with my TotalCalendar class. In this class I'm adding every events ( for example: 20 events ) to my own calendar. I should add this events to Google Calendar, but stil it's adding to device calendar. How can I change it? When I put single event to calendar, I can choose kind of calendar, but in this situation, I can't.
public class TotalCalendar {
Context mContext;
Intent mIntent;
public TotalCalendar(Context context) {
this.mContext = context;
}
public boolean insert(String dzien, String miesiac, String lokacja, String tytul, String opis, String godziny) {
int year = Calendar.getInstance().get(Calendar.YEAR);
Calendar beginTime = Calendar.getInstance();
Calendar endTime = Calendar.getInstance();
int currentMonth = Calendar.getInstance().get(Calendar.MONTH);
if((Miesiac(miesiac) == 0) && (currentMonth == 11) )
{
year++;
}
int hh1 = 0;
int mm1 = 0;
int hh2 = 0;
int mm2 = 0;
if(isNumeric(getHH1(godziny)) && isNumeric(getMM2(godziny)))
{
Log.d("debug","numeric");
hh1 = Integer.valueOf(getHH1(godziny)).intValue();
mm1 = Integer.valueOf(getMM1(godziny)).intValue();
hh2 = Integer.valueOf(getHH2(godziny)).intValue();
mm2 = Integer.valueOf(getMM2(godziny)).intValue();
}
else
{
hh1 = 0;
mm1 = 0;
hh2 = 0;
mm2 = 0;
}
beginTime.set(year, Miesiac(miesiac), Integer.valueOf(dzien).intValue(), hh1, mm1);
endTime.set(year, Miesiac(miesiac), Integer.valueOf(dzien).intValue(), hh2, mm2);
Log.d("debug", "Begin time: " + Miesiac(miesiac) + " " + Integer.valueOf(dzien));
long startMillis = beginTime.getTimeInMillis();
long endMillis = endTime.getTimeInMillis();
ContentResolver cr = mContext.getContentResolver();
ContentValues values = new ContentValues();
TimeZone tz = TimeZone.getDefault();
values.put(CalendarContract.Events.DTSTART, startMillis);
values.put(CalendarContract.Events.DTEND, endMillis);
values.put(CalendarContract.Events.TITLE,tytul);
values.put(CalendarContract.Events.DESCRIPTION,opis);
values.put(CalendarContract.Events.CALENDAR_ID,1);
values.put(CalendarContract.Events.EVENT_TIMEZONE,tz.getID());
Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI,values);
Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
builder.appendPath("time");
ContentUris.appendId(builder, startMillis);
this.mIntent = new Intent(Intent.ACTION_VIEW).setData(builder.build());
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(mIntent);
return true;
}
Hello everyone i try to check between days two daytimes
i have for example 12/10/2014 and 12/15/2015 datetimes.I wrote some code witch can to check different days between there two daytimes
this is a my source
public String getDateDiffString(Date dateOne, Date dateTwo) {
long timeOne = dateOne.getTime();
long timeTwo = dateTwo.getTime();
long oneDay = 1000 * 60 * 60 * 24;
long delta = (timeTwo - timeOne) / oneDay;
if (delta > 0) {
return String.valueOf(delta);
} else {
delta *= -1;
return String.valueOf(delta);
}
}
this code working perfect but i want to increase days for example 12/10/2014, 12/11,2014.....12/20/2014 between first and second daytimes.i i also wrote code but result is between first date and second days -1(between 12/19/2014)
this is a my source
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Date _d;
try {
SimpleDateFormat new_df = new SimpleDateFormat("d MMM");
_d = df.parse(timeInfo.getTimeformat().get(0));
Date _d1 = df.parse(timeInfo.getEndTimeFormat().get(0));
String datetimeis = getDateDiffString(_d1, _d);
int differentdays = Integer.parseInt(datetimeis);
Log.e("Different is ", "" + differentdays);
for (int k = 0; k < differentdays; k++) {
String datetimeformat = dateFormatter(timeInfo.getStartTimePeriod().get(0));
Date datetime = new_df.parse(datetimeformat);
Calendar cal = Calendar.getInstance();
cal.setTime(datetime);
cal.add(Calendar.DATE, k);
datetime = cal.getTime();
String ttime = new_df.format(datetime);
ApishaDaysAdapter.add(ttime);
ApishaHollsAdapter.add(timeInfo.getHole());
String start_time = timeInfo.getTime();
start_time = start_time.replace(",", "\n");
ApishaTimesAdapter.add(start_time);
timeInfo.setStartTimePeriod(ttime);
System.out.println(ttime);
}
} catch (ParseException e) {
e.printStackTrace();
}
}
how i can solve my problem?if anyone knows solution please help me
i want to increase days [12 -20] and not [12-19)
In my android program, I have a spinner that allows the user to select different times. Each selection is processed with Joda time to subtract the minutes. It works fine for minutes 0 to 59 and 61 and greater. However, when 60 minutes is subtracted, the time is not updated, and the original time is shown.
How do I get Joda time to subtract 60 minutes?
Spinner:
public class MyOnItemSelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent, View view, int pos,
long id1) {
String mins = parent.getItemAtPosition(pos).toString();
int intmins=0;
// process user's selection of alert time
if(mins.equals("5 minutes")){intmins = 5;}
if(mins.equals("10 minutes")){intmins = 10;}
if(mins.equals("20 minutes")){intmins = 20;}
if(mins.equals("30 minutes")){intmins = 30;}
if(mins.equals("40 minutes")){intmins = 40;}
if(mins.equals("50 minutes")){intmins = 50;}
if(mins.equals("60 minutes")){intmins = 60;}
if(mins.equals("120 minutes")){intmins = 120;}
String stringMinutes=""+intmins;
setAlarm(intmins, stringMinutes);
} else {
}
public void onNothingSelected(AdapterView parent) {
mLocationDisplay.setText(" " + location);
}
}
public void setAlarm(int intmins, String mins) {
// based alarm time on start time of event. TODO get info from database.
String currentDate;
SimpleDateFormat myFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date date1 = null;
DateTime dt;
currentDate = eventdate + " " + startTimeMilitary;// startTimeMilitary;
try {
date1 = myFormat.parse(currentDate);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
dt = new DateTime(date1);
long dateInMillis = dt.getMillis();
String sDateInMillis = Long.toString(dateInMillis);
// subtract the selected time from the event's start time
String newAlertTime = subtractTime(dt, intmins);
newAlertTime = subtractTime(dt, intmins);
//......}
public String subtractTime(DateTime dt, int minusTime) {
DateTime greaterDate;
greaterDate = dt.minusMinutes(minusTime);
// newAlertTime is in UTC format
String newAlertTime = greaterDate.toString();
long alertInMillis = greaterDate.getMillis();
String sAlertInMillis = Long.toString(alertInMillis);
// ////new alert time is a stirng
setStringAlertInMillis(sAlertInMillis);
return newAlertTime;
}
1) Remove hardcode.
Use
final String mins = parent.getItemAtPosition(pos).toString();
final Pattern minutes = Pattern.compile("([0-9]+) minutes");
final Matcher m = minutes.matcher(mins);
String stringMinutes = "0";
if (mins.matches())
{
stringMinutes = m.group(1);
}
setAlarm(Integer.parseInt(stringMinutes), stringMinutes);
instead of your hardcode
String mins = parent.getItemAtPosition(pos).toString();
// your hardcode is here
setAlarm(Integer.parseInt(stringMinutes), stringMinutes);
2) Use DateTimeFormatter instead of SimpleDateFormatter
You get java Date using SimpleDateFormatter and create DateTime by this date.
DateTimeFormatter formatter = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm:ss");
dt = formatter.parseDateTime(currentDate);
3) Joda works well
in this code no problem with Joda.
String subtractTime(DateTime dt, int minusTime)
should works well.
Debug you code, problem is before
if(mins.equals("5 minutes")){intmins = 5;}
if(mins.equals("10 minutes")){intmins = 10;}
//...
I am trying to remove data from hashtable for a particular date,the hashtable is of type (String,vector).Initially i am checking if hashtable contains the usrDate if yes then i need to remove all the data frm hashtable only for usrDate and add the new data that is listEvents.But the contains from hashtable for other dates should not be deleted.
listEvents.addElement(eventBean);//new data is here
for (int i = 0; i < listEvents.size();i++) {
EventData e = (EventData)listEvents.elementAt(i);
}
//checking if hashtable has given date
if (listUserEvents.containsKey(usrDate)) {
Vector info = (Vector)listUserEvents.get(usrDate);
info.addElement(eventBean);
listUserEvents.put(usrDate,info);
} else {
listUserEvents.put(usrDate,listEvents);
}
i just want to add listEvents to the hashtable for the given date,without affecting the other data in hashtable which has data for some other dates.
private Hashtable getEvents(String usrDate, String timezone) {
try {
listUserEvents = getUserInfo();
listEvents = new Vector();
Calendar calendarLocalEvent = Calendar.getInstance();
// fetches time zone
TimeZone timeZoneEvent = calendarLocalEvent.getTimeZone();
System.out.println("Time Zone first-->"
+ timeZoneEvent.getDefault());
if (timezone.equals(timeZoneEvent.getDefault())) {
;
} else {
TimeZone timeZoneChange = TimeZone.getTimeZone(timezone);
System.out.println("Time Zone change-->" +timeZoneChange);
Device.setTimeZone(timeZoneChange);
}
EventList eventList = (EventList) PIM.getInstance().openPIMList(
PIM.EVENT_LIST, PIM.READ_ONLY);
Enumeration events = eventList.items();
while (events.hasMoreElements()) {
System.out.println("in while");
Event event = (Event) events.nextElement();
if (eventList.isSupportedField(Event.START)
&& event.countValues(Event.START) > 0)
{
long start = event.getDate(Event.START, 0);
SimpleDateFormat sdf = new SimpleDateFormat(
"MMM dd,yyyy HH:mm");
SimpleDateFormat sdf_start = new SimpleDateFormat("HH:mm");
SimpleDateFormat sdf_start_min = new SimpleDateFormat("HH");
String dateString = sdf.formatLocal(start);
String timeString = sdf_start.formatLocal(start);
String hour = sdf_start_min.formatLocal(start);
SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd,yyyy");
String date = sdf1.formatLocal(start);
System.out.println("dates are :" + date +"user" + usrDate);
if (usrDate.equalsIgnoreCase(date)) {
System.out.println("dates are equal:" +date);
EventData eventBean = new EventData();
if (eventList.isSupportedField(Event.END)
&& event.countValues(Event.END) > 0) {
long end = event.getDate(Event.END, 0);
SimpleDateFormat sdform = new SimpleDateFormat(
"MMM dd, yyyy HH:mm");
SimpleDateFormat sdfTime = new SimpleDateFormat(
"HH:mm");
SimpleDateFormat sdfhr = new SimpleDateFormat("HH");
String dateString1 =sdform.formatLocal(end);
String timeString1 =sdfTime.formatLocal(end);
String hr = sdfhr.formatLocal(end);
eventBean.setStartHr(hour);
eventBean.setEndHr(hr);
eventBean.setStartTime(timeString);
eventBean.setEndTime(timeString1);
eventBean.setStartDate(dateString);
eventBean.setEndDate(dateString1);
// Dialog.alert("equal startdate" + dateString);
// Dialog.alert("equal end date"+ dateString1);
}
if (eventList.isSupportedField(Event.LOCATION)
&& event.countValues(Event.LOCATION) > 0) {
String location = event
.getString(Event.LOCATION, 0);
eventBean.setLocation(location);
// Dialog.alert("equal location"+ location);
}
if (eventList.isSupportedField(Event.SUMMARY)
&& event.countValues(Event.SUMMARY) > 0) {
String subject = event.getString(Event.SUMMARY, 0);
eventBean.setSummary(subject);
// Dialog.alert("equal subject" +subject);
}
eventBean.setUserDate(usrDate);
eventBean.setTimeZone(timezone);
listEvents.addElement(eventBean);
System.out.println("the size bf hashis"
+ listEvents.size());
for (int i = 0; i < listEvents.size();i++) {
EventData e = (EventData)listEvents.elementAt(i);
System.out.println("so thesummary is ::"
+ e.getSummary());
}
// for(int i=0;i<listUserEvents.size();i++){
if (listUserEvents.containsKey(usrDate)) {
// listUserEvents.remove(usrDate);
Vector info = (Vector)listUserEvents.get(usrDate);
System.out.println("the size in getEvents is"
+ info.size());
if(info.contains(usrDate)){
System.out.println("in info");
}
info.addElement(eventBean);
System.out.println("vector size info is"
+ info.size());
listUserEvents.put(usrDate,info);
} else {
System.out.println("in else of getevent" +listEvents.size());
listUserEvents.put(usrDate,listEvents);
}
// }
} else {
// Dialog.alert("not equal");
}
}
}
Device.setTimeZone(timeZoneEvent);
Calendar calendarLocalLastEvent = Calendar.getInstance();
// fetches time zone
TimeZone timeZoneEventLast =calendarLocalLastEvent.getTimeZone();
System.out.println("Time Zone last-->"
+ timeZoneEventLast.getDefault());
} catch (PIMException e) {
// //Dialog.alert(e.getMessage());
}
System.out.println("size in hashtable " + listUserEvents.size());
return listUserEvents;
}
It must be something like this
for(int i = 0; i<listUserEvents.size();i++)
{
if (listUserEvents.containsKey(usrDate)){
listUserEvents.remove(usrDate);
}
}
Here is a simple example of how this works:
Hashtable<String, Integer> numbers = new Hashtable<String, Integer>();
numbers.put("one", 1);
numbers.put("two", 2);
if (numbers.containsKey("two")) {
numbers.put("two", 222);
}
What are you having difficulty at? Moreover what is the type of your Hashtable key? Is it java.util.Date or something else?