Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {
    public static String getThisYearBirthDateString(final Date birthday) {
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy", Locale.getDefault());
        String y = sdf.format(now);
        sdf = new SimpleDateFormat("M-d", Locale.getDefault());
        String md = sdf.format(birthday);
        String ymd = y + "-" + md;

        return ymd;
    }
}