Java SQL Date Format dateFormatJson(Date date)

Here you can find the source of dateFormatJson(Date date)

Description

date Format Json

License

Apache License

Declaration

public static String dateFormatJson(Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Date;

import java.util.Calendar;

public class Main {
    public static String dateFormatJson(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);/*from w  w w  .j  a  va  2  s  .  c  o  m*/

        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH) + 1;
        int day = cal.get(Calendar.DAY_OF_MONTH);

        return year + "," + month + "," + day;
    }
}

Related

  1. dateFormat(Object obj, String parten)
  2. dateFormat(String sdate, String format)
  3. dateFromLong(Long longObject)
  4. formataData(Date data)
  5. formatAsText(ResultSet result_set, PrintWriter out)
  6. formatBytableCols(Object[] obj, String[] tableCols)