I need to get the data from a datefield calender and be able to display it in a string and later store it in a recordstore. I tried the toString() method but i had an error once run.
StartDate = new DateField('Start Date ', DateField.DATE); StartDate.setDate(Calendar.getInstance().getTime());
I now have this code
public static String dateToString (long date) { Calendar c = Calendar.getInstance() ; c.setTime(new Date(date)); int y = c.get(Calendar.YEAR); int m = c.get(Calendar.MONTH) + 1; int d = c.get(Calendar.DATE); String t = (y<10? '0': '')+y+'-'+(m<10? '0': '')+m+'-'+(d<10? '0': '')+d; return t; }
How can I change this in order for this to get the date from Startdate and make that t.?
If anyone could help!
There are some sample implementations that may help you get started, since it appears your runtime doesn’t provide a useful
toStringimplementation.