Skip to content

Instantly share code, notes, and snippets.

@smaznet
Created July 6, 2016 13:53
Show Gist options
  • Save smaznet/ba0e445ef80aa3a92c7e471367c98d3f to your computer and use it in GitHub Desktop.
Save smaznet/ba0e445ef80aa3a92c7e471367c98d3f to your computer and use it in GitHub Desktop.
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a date with yyyymm format: \n");
String number1 = input.next();
System.out.println(Yyyymm2mmmyy(number1));
}
public static String Yyyymm2mmmyy(String input){
String[] names=new String[]{"Jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};
String iny=input.substring(0,4);
String inm=input.substring(4);
String changed="i";
return names[Integer.valueOf(inm)-1]+iny.substring(2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment