전문연구요원 소집해제 날짜 계산기.

해밝의 이미지

오늘 전문연구요원 단축에 관한 세부 사항이 결정났다고 하는군요. 그래서 간단하게 만들어보았습니다.

단점은 2004년 3월 이후 편입자에 한해서 제대로된 날짜 계산이 됩니다.

사용방법은 다음과 같습니다. 날짜는 yyyyMMdd 포맷으로 입력하시고 전문연구요원 편입된 날짜를 넣어주시면 됩니다. 그러면 소집해제 일자를 출력해줍니다.

  java Dday 날짜 

import java.util.*;
import java.text.*;

public class Dday
{
  public Dday()
  {
  }

  public static void main(String[] args) throws Exception
  {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    Date startDate = sdf.parse(args[0]);

    Calendar startCalendar = Calendar.getInstance();
    startCalendar.setTime(startDate);

    Calendar endCalendar = (Calendar) startCalendar.clone();
    endCalendar.add(Calendar.YEAR, 4);
    endCalendar.add(Calendar.DATE, -1);

    Calendar cur = Calendar.getInstance();

    long endLong = endCalendar.getTime().getTime();

    long curLong = cur.getTime().getTime();

    long diffLong = endLong - curLong;

    long diffDay = diffLong / 1000 / 60 / 60 / 24;

    diffDay = (long) ((double) diffDay * 0.75d);


    cur.add(Calendar.DATE, (int)diffDay);

    System.out.println(sdf.format(cur.getTime()));

  }
}

Forums: 
bus710의 이미지

옵션도 넣어 주세요.

병무청 조사에서 한번 걸리면 대략 보름씩 늘어 나잖아요.

java Dday --penalty 페널티 횟수

라든가;;

앗, 연구요원은 병무청에서 복무현황 조사 안나오나요?;;

life is only one time

익명 사용자의 이미지

병특들은 한번씩 만들게 되는 프로그램이네요.
이번엔 자바버전이네요.
어떤 사람은 PHP 버전, 어떤 사람은 스크립트로..ㅋㅋ

하지만 공통된 문제점은 자신이 시작한 날짜 또는 끝나는 날짜 위주라 범용성이 떨어진다는 거죠.

exman의 이미지

저도 병특을 시작하자 마자.. (2000년도에...)

파이썬 코딩 습작 차원에서 기념일 관리 프로그램을 만들었습니다.

기념일은 바로 소집해제의 그날 이었지요...

병특이라면 누구나 만들어 보게 되는 그 날짜 계산 프로그램이 저에게는 소중한 학습이 되어 지금까지 파이썬으로 밥벌어 먹고 살고 있습니다.

:)

saxboy의 이미지

으흐흐. 저도 MFC버전으로 하나 만들어서 화면에 띄워놓고 살았던 적이 있답니다. :D

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.