Java Day of getApisPaxBirthday(String dob)

Here you can find the source of getApisPaxBirthday(String dob)

Description

get Apis Pax Birthday

License

Open Source License

Declaration

public static String getApisPaxBirthday(String dob) 

Method Source Code


//package com.java2s;
/*//w w  w .jav a  2 s  .  c  o  m
 * All GTAS code is Copyright 2016, Unisys Corporation.
 * 
 * Please see LICENSE.txt for details.
 */

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static String getApisPaxBirthday(String dob) {
        //06MAR72
        //String day=dob.substring(0, 1);
        //int year = Integer.parseInt(dateString.substring(0, 4));
        //int month = Integer.parseInt(dateString.substring(4, 6));
        //int day = Integer.parseInt(dateString.substring(6));
        int day = Integer.parseInt(dob.substring(0, 2));
        String month = dob.substring(2, 5);
        int mon = 1;

        switch (month) {
        case "JAN":
            mon = 1;
            break;
        case "FEB":
            mon = 2;
            break;
        case "MAR":
            mon = 3;
            break;
        case "APR":
            mon = 4;
            break;
        case "MAY":
            mon = 5;
            break;
        case "JUN":
            mon = 6;
            break;
        case "JUL":
            mon = 7;
            break;
        case "AUG":
            mon = 8;
            break;
        case "SEP":
            mon = 9;
            break;
        case "OCT":
            mon = 10;
            break;
        case "NOV":
            mon = 11;
            break;
        case "DEC":
            mon = 12;
            break;
        }
        int year = Integer.parseInt(dob.substring(5));

        Calendar cal = new GregorianCalendar(year, mon, day);
        Date date = cal.getTime();
        SimpleDateFormat df = new SimpleDateFormat("yyMMdd");
        //System.out.println("DOB<<<<<<<<<<----"+df.format(date));
        return df.format(date);
    }
}

Related

  1. get1DayBeforDate()
  2. get8BitTime(Date date, int deltaDay)
  3. getAfterDays(String date, String pattern, int afterDays)
  4. getAge(Date birthDay)
  5. getAgeOfCalendar(String birthDayString)
  6. getBeforeDate(int day)
  7. getBeforeOrAfterDay(Date date, String format, Integer days)
  8. getBeginEndTimeOfDay(Date day)
  9. getBeginOfDay(Date date)