Java Code Examples for java.util.Locale#KOREA

The following examples show how to use java.util.Locale#KOREA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DpiStatisticsManager.java    From onos with Apache License 2.0 6 votes vote down vote up
private void processResultJson(String resultJsonString) {
    Date tr = new Date(System.currentTimeMillis());
    SimpleDateFormat df = new SimpleDateFormat(DATE_FMT, Locale.KOREA);
    df.setTimeZone(TimeZone.getTimeZone(TIME_ZONE));

    String curReceivedTime = new String(df.format(tr));
    String curResultJson = new String(resultJsonString);

    DpiStatInfo dpiStatInfo;
    ObjectMapper mapper = new ObjectMapper();
    try {
        dpiStatInfo = mapper.readValue(curResultJson, DpiStatInfo.class);
    } catch (IOException e) {
        log.error("DpiStatisticsListener: ObjectMapper Exception = {}", e.toString());
        return;
    }

    DpiStatistics dpiStatistics = new DpiStatistics(curReceivedTime, dpiStatInfo);

    addDpiStatistics(dpiStatistics);
}
 
Example 2
Source File: Utils.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static String getTimeStamp() {
String rtnStr = null;
	
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";
	
try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());
	
    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
	
    //throw new RuntimeException(e);	// 보안점검 후속조치
}
return rtnStr;
  }
 
Example 3
Source File: DateTimeUtil.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
   * 2011.08.09
   * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
   *
   * @param
   * @return Timestamp 값
   * @exception MyException
   * @see
   */
  public static String getTimeStamp() {
String rtnStr = null;
	
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";
	
try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());
	
    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
	
    //throw new RuntimeException(e);	// 보안점검 후속조치
}
return rtnStr;
  }
 
Example 4
Source File: StringUtil.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
   * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
   *
   * @param
   * @return Timestamp 값
   * @exception MyException
   * @see
   */
  public static String getTimeStamp() {
String rtnStr = null;

// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";

try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());

    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
    throw new RuntimeException(e);	// 2011.10.10 보안점검 후속조치
}

return rtnStr;
  }
 
Example 5
Source File: StringUtil.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
   * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
   *
   * @param
   * @return Timestamp 값
   * @exception MyException
   * @see
   */
  public static String getTimeStamp() {
String rtnStr = null;

// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";

try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());

    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
    throw new RuntimeException(e);	// 2011.10.10 보안점검 후속조치
}

return rtnStr;
  }
 
Example 6
Source File: Utils.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static String getTimeStamp() {
String rtnStr = null;
	
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";
	
try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());
	
    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
	
    //throw new RuntimeException(e);	// 보안점검 후속조치
}
return rtnStr;
  }
 
Example 7
Source File: DateTimeUtil.java    From SI with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
   * 2011.08.09
   * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
   *
   * @param
   * @return Timestamp 값
   * @exception MyException
   * @see
   */
  public static String getTimeStamp() {
String rtnStr = null;
	
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
String pattern = "yyyyMMddhhmmssSSS";
	
try {
    SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
    Timestamp ts = new Timestamp(System.currentTimeMillis());
	
    rtnStr = sdfCurrent.format(ts.getTime());
} catch (Exception e) {
    //e.printStackTrace();
	
    //throw new RuntimeException(e);	// 보안점검 후속조치
}
return rtnStr;
  }
 
Example 8
Source File: NumberUtil.java    From SI with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
    * 숫자타입을 데이트 타입으로 변환하는 기능
    * 숫자 20081212를 데이트타입  '2008-12-12'로 변환하는 기능
    * @param srcNumber - 숫자
    * @return String
    * @exception MyException
    * @see
    */
   public static String getNumToDateCnvr(int srcNumber) {

String pattern = null;
String cnvrStr = null;

String srcStr = String.valueOf(srcNumber);

// Date 형태인 8자리 및 14자리만 정상처리
if (srcStr.length() != 8 && srcStr.length() != 14) {
    throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length());
}

if (srcStr.length() == 8) {
    pattern = "yyyyMMdd";
} else if (srcStr.length() == 14) {
    pattern = "yyyyMMddhhmmss";
}

SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA);

Date cnvrDate = null;

try {
    cnvrDate = dateFormatter.parse(srcStr);
} catch (ParseException e) {
    //e.printStackTrace();
    throw new RuntimeException(e);
}

cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate);

return cnvrStr;

   }
 
Example 9
Source File: FastDateParserTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testLang1121() throws ParseException {
    final TimeZone kst = TimeZone.getTimeZone("Asia/Seoul");
    final DateParser fdp = getInstance("yyyyMMdd", kst, Locale.KOREA);

    try {
        fdp.parse("2015");
        Assert.fail("expected parse exception");
    } catch (final ParseException pe) {
        // expected parse exception
    }

    // Wed Apr 29 00:00:00 KST 2015
    Date actual = fdp.parse("20150429");
    final Calendar cal = Calendar.getInstance(kst, Locale.KOREA);
    cal.clear();
    cal.set(2015, 3, 29);
    Date expected = cal.getTime();
    Assert.assertEquals(expected, actual);

    final SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd", Locale.KOREA);
    df.setTimeZone(kst);
    expected = df.parse("20150429113100");

    // Thu Mar 16 00:00:00 KST 81724
    actual = fdp.parse("20150429113100");
    Assert.assertEquals(expected, actual);
}
 
Example 10
Source File: DpiStatisticsManager.java    From onos with Apache License 2.0 5 votes vote down vote up
private long convertTimeToLong(String timeString) {
    long timeLong = 0;

    try {
        // Time format: yyyy-MM-dd HH:mm:ss, Time Zone: GMT
        SimpleDateFormat df = new SimpleDateFormat(DATE_FMT, Locale.KOREA);
        df.setTimeZone(TimeZone.getTimeZone(TIME_ZONE));

         timeLong = df.parse(timeString).getTime();
    } catch (ParseException e) {
        log.error("Time parse error! Exception={}", e.toString());
    }

    return timeLong;
}
 
Example 11
Source File: NumberUtil.java    From SI with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
    * 숫자타입을 데이트 타입으로 변환하는 기능
    * 숫자 20081212를 데이트타입  '2008-12-12'로 변환하는 기능
    * @param srcNumber - 숫자
    * @return String
    * @exception MyException
    * @see
    */
   public static String getNumToDateCnvr(int srcNumber) {

String pattern = null;
String cnvrStr = null;

String srcStr = String.valueOf(srcNumber);

// Date 형태인 8자리 및 14자리만 정상처리
if (srcStr.length() != 8 && srcStr.length() != 14) {
    throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length());
}

if (srcStr.length() == 8) {
    pattern = "yyyyMMdd";
} else if (srcStr.length() == 14) {
    pattern = "yyyyMMddhhmmss";
}

SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA);

Date cnvrDate = null;

try {
    cnvrDate = dateFormatter.parse(srcStr);
} catch (ParseException e) {
    //e.printStackTrace();
    throw new RuntimeException(e);
}

cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate);

return cnvrStr;

   }
 
Example 12
Source File: ExampleUnitTest.java    From android with MIT License 5 votes vote down vote up
@Test
public void testStringLocale() throws Exception {
    Locale[] locales = new Locale[]{
            Locale.CANADA,
            Locale.CANADA_FRENCH,
            Locale.CHINESE,
            Locale.ENGLISH,
            Locale.FRANCE,
            Locale.GERMAN,
            Locale.GERMANY,
            Locale.ITALIAN,
            Locale.ITALY,
            Locale.JAPAN,
            Locale.JAPANESE,
            Locale.KOREA,
            Locale.KOREAN,
            Locale.PRC,
            Locale.ROOT,
            Locale.SIMPLIFIED_CHINESE,
            Locale.TAIWAN,
            Locale.TRADITIONAL_CHINESE,
            Locale.UK,
            Locale.US
    };

    String weightString = null;
    for (Locale locale : locales) {
        try {
            weightString = formatFloatWithOneDot(locale, 55.4f);
            float weight = Float.parseFloat(weightString);
        } catch (NumberFormatException e) {
            System.out.println(locale + ">>>>>" + weightString + ">>>>>>>>>> error");
            continue;
        }
        System.out.println(locale + ">>>>>" + weightString);
    }
}
 
Example 13
Source File: LocaleTransform.java    From PictureSelector with Apache License 2.0 5 votes vote down vote up
public static Locale getLanguage(int language) {
    switch (language) {
        case LanguageConfig.ENGLISH:
            // 英语-美国
            return Locale.ENGLISH;
        case LanguageConfig.TRADITIONAL_CHINESE:
            // 繁体中文
            return Locale.TRADITIONAL_CHINESE;
        case LanguageConfig.KOREA:
            // 韩语
            return Locale.KOREA;
        case LanguageConfig.GERMANY:
            // 德语
            return Locale.GERMANY;
        case LanguageConfig.FRANCE:
            // 法语
            return Locale.FRANCE;
        case LanguageConfig.JAPAN:
            // 日语
            return Locale.JAPAN;
        case LanguageConfig.VIETNAM:
            // 越南语
            return new Locale("vi");
        default:
            // 简体中文
            return Locale.CHINESE;
    }
}
 
Example 14
Source File: EgovNumberUtil.java    From oslits with GNU General Public License v3.0 5 votes vote down vote up
/**
   * 숫자타입을 데이트 타입으로 변환하는 기능
   * 숫자 20081212를 데이트타입  '2008-12-12'로 변환하는 기능
   * @param srcNumber - 숫자
   * @return String
   * @see
   */
  public static String getNumToDateCnvr(int srcNumber) {

String pattern = null;
String cnvrStr = null;

String srcStr = String.valueOf(srcNumber);

// Date 형태인 8자리 및 14자리만 정상처리
if (srcStr.length() != 8 && srcStr.length() != 14) {
	throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length());
}

if (srcStr.length() == 8) {
	pattern = "yyyyMMdd";
} else if (srcStr.length() == 14) {
	pattern = "yyyyMMddhhmmss";
}

SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA);

Date cnvrDate = null;

try {
	cnvrDate = dateFormatter.parse(srcStr);
} catch (ParseException e) {
	LOGGER.error("ERROR parsing", e.getMessage());
}

cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate);

return cnvrStr;

  }
 
Example 15
Source File: WrapLocale.java    From jphp with Apache License 2.0 4 votes vote down vote up
@Signature
public static Memory KOREA(Environment env, Memory... args) {
    return new ObjectMemory(new WrapLocale(env, Locale.KOREA));
}
 
Example 16
Source File: EgovFileMngUtil.java    From oslits with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 공통 컴포넌트 utl.fcc 패키지와 Dependency제거를 위해 내부 메서드로 추가 정의함
 * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
 *
 * @param
 * @return Timestamp 값
 * @see
 */
private static String getTimeStamp() {

	String rtnStr = null;

	// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
	String pattern = "yyyyMMddhhmmssSSS";

	SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
	Timestamp ts = new Timestamp(System.currentTimeMillis());

	rtnStr = sdfCurrent.format(ts.getTime());

	return rtnStr;
}
 
Example 17
Source File: EgovStringUtil.java    From oslits with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
 *
 * @param
 * @return Timestamp 값
 * @exception MyException
 * @see
 */
public static String getTimeStamp() {

	String rtnStr = null;

	// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
	String pattern = "yyyyMMddhhmmssSSS";

	SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
	Timestamp ts = new Timestamp(System.currentTimeMillis());

	rtnStr = sdfCurrent.format(ts.getTime());

	return rtnStr;
}