Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static String toStandardFormat(String str) {
        String[] s = str.split("-");
        String tailStr;
        if (s[1].length() == 1) {
            tailStr = "0" + s[1] + s[2];
        } else {

            tailStr = s[1] + s[2];
        }

        String headStr = Calendar.getInstance().get(Calendar.YEAR) + "";
        return headStr + tailStr;
    }
}