on 01-23-2013 6:35 AM
Hi,
I have an MBO in which there are two fields with datatype "date".
When I write android native code how can I manage it?
I am able to bring other fields to the device but the date fields are null.
Given below is the code used in the android.
for(Past_Substitutions itemheader : Past_Substitutions.findAll())
{
item = new PastSubstitutionsBO();
item.setEMAIL(itemheader.getEMAIL());
item.setEND_DATE(itemheader.getEND_DATE());
item.setPHONE_NUMBER(itemheader.getPHONE());
item.setSTART_DATE(itemheader.getSTART_DATE());
item.setSUBSTITUTE_NAME(itemheader.getSUBSTITUTE_NAME());
item.setSUBSTITUTE_POSITION(itemheader.getSUBSTITUTE_POSITION());
item.setSUBSTITUTE_USER_NUMBER(itemheader.getSUBSTITUTE_PERNR());
items.add(item);
}
I debugged the same even in the object "itemheader" the date field is null. If it was present them I would have converted those to date fields.
How we can solve this issue?
Thanks
Midhun
Found the solution.
It was straight forward.My bad. I haven't tried different ways.
Here you go..
SimpleDateFormat formatDateJava = new SimpleDateFormat("MM/dd/yyyy");
for(Substitutions itemheader : Substitutions.findAll())
{
item = new PastSubstitutionsBO();
item.setEND_DATE(formatDateJava.format(itemheader.getSTART_DATE()));
items.add(item);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi midhun,
Check for the date class http://developer.android.com/reference/java/util/Date.html
first you need to make sure you have to get date from server in string form. If you are getting try to format it using the Date class.
Regards,
Swapnil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.