๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ปTech/โ˜•Java

[Java] ์›ํ•˜๋Š” ํฌ๋งท์œผ๋กœ ํ˜„์žฌ ๋‚ ์งœ ์ถœ๋ ฅ

by _viper_ 2019. 7. 5.
๋ฐ˜์‘ํ˜•

์›ํ•˜๋Š” ๋‚ ์งœ ํฌ๋งท(yyyyMMdd,yyyyMMddHH ๋“ฑ)์„ ์ž…๋ ฅํ•˜์—ฌ ํ˜„์žฌ๋‚ ์งœ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

  public static String getCurrent(String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    return sdf.format(Calendar.getInstance().getTimeInMillis());
  }