Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * 
     * @description getStringDateFromYmd
     * @param year
     * @param month
     * @param day
     * @return 2014-08-30
     * @exception
     */
    public static String getStringDateFromYmd(int year, int month, int day) {
        String y = String.valueOf(year);
        String m = String.valueOf(month);
        if (month < 10) {
            m = "0" + m;
        }
        String d = String.valueOf(day);
        if (day < 10) {
            d = "0" + d;
        }
        return y + "-" + m + "-" + d;
    }
}