将LocalDateTime转换为时间戳

时间:2019-05-04 17:31:37

标签: java

我正在使用LocalDateTime和TemporalAdjusters将DateTime设置为一周的前一个星期日。例如,如果我的用户今天提交索赔,则索赔日期应为该周的前一个星期日。

这是我的代码-

    public class Adapter_Rec extends 
    RecyclerView.Adapter<Adapter_Rec.MyViewHolder> {
    private List<Spells> list = new LinkedList<>();
    Context context;
    public Adapter_Rec(List<Spells> list, Context context)
    {
    this.context=context;
    this.list=list;
    }

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v;
    v = LayoutInflater.from(context).inflate
    (R.layout.spells_recycle,parent,false);
    MyViewHolder vholder = new MyViewHolder(v);
return vholder;
}

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    holder.check.setOnCheckedChangeListener(null);


    holder.name.setText(list.get(position).getName());
    holder.benefits.setText(list.get(position).getDescription());




}

@Override
public int getItemCount() {
    return list.size();
}

public static class MyViewHolder extends RecyclerView.ViewHolder
{
    TextView name;
    TextView benefits;

    CheckBox check ;
    public MyViewHolder(View item)
    { super(item);
        name = item.findViewById(R.id.namee);
        benefits = item.findViewById(R.id.desc);
        check =item.findViewById(R.id.check);
    }





}
}

我收到了一个错误消息,即ClaimsDateSO文件中的ClaimsDate已声明为Timestamp。我将如何转换localdatetime以匹配TimeStamp。

0 个答案:

没有答案