Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1st challenge results (telegram.me/code_challenges)
<?php
strtoupper(date('My',strtotime($i.'01')));
<?php
$months = array("01"=>"JAN","02"=>"FEB","03"=>"MAR","04"=>"APR","05"=>"MAY","06"=>"JUN","07"=>"JUL","08"=>"AUG","09"=>"SEP","10"=>"OCT","11"=>"NOV","12"=>"DEC");
$year = @substr($_GET['date'],0,4);
$month = @substr($_GET['date'],4,2);
if(@$months[$month] && strlen($_GET['date']) == 6 && strlen($year) == 4 && strlen($month) == 2){
echo $months[$month].substr($year,2,2);
} else { die("Invalid Input , Corect input : YYYYMM"); }
@set d=%1
@for %%m in (JAN.01 FEB.02 MAR.03 APR.04 MAY.05 JUN.06 JUL.07 AUG.08 SEP.09 OCT.10 NOV.11 DEC.12) do @if %%~xm==.%d:~4% echo %%~nm%d:~2,2%
import java.text.*;String i(String i)throws Exception{return new SimpleDateFormat("MMMyy").format(new SimpleDateFormat("yyyyMM").parse(i)).toUpperCase();}
a=>(new Date(0,a[4]+a[5]-1)+"").slice(4,7).toUpperCase()+a[2]+a[3]
@(x)upper(datestr(datenum(x,'yyyymm'),12))
Dim ar() As String=Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC")
Log(ar(r.SubString(4)-1)&r.SubString2(2,4))
<?php
function setdate($set){
if(preg_match("/^[0-9]{4,4}+[0-9]{2,2}+$/",$set)){
for($i=0;$i<6;$i++){
if(($i==2)||($i==3))
@$y.=$set[$i];
if($i>3)
@$m.=$set[$i];
}
$month=[
'01'=>'JAN',
'02'=>'FEB',
'03'=>'MAR',
'04'=>'APR',
'05'=>'MAY',
'06'=>'JUN',
'07'=>'JUL',
'08'=>'AUG',
'09'=>'SEP',
'10'=>'OCT',
'11'=>'NOV',
'12'=>'DEC'
];
echo $month[$m].$y;
}else echo "Input Date Invalid.InputMask(YYYYMM:e.g 201607)";
}
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);
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