Less than 1 minute
Less than 1 minute
Less than 1 minute
A. 기본설정
A1. regedit
설정
윈도우 작업표시줄 검색창이나 +R(실행) 열어서
cmd
를 ctrl+shift+enter 눌러 실행합니다.
Prerequesite(s)
First, ensure that you open prompt in ADMINISTRATIVE mode
About 3 min
공통
자주쓰는 Singleton Pattern
자주쓰는 Enum Pattern
자주쓰는 Documentation
자주쓰는 Builder Pattern
data class FooBar(
val a: String = ""
val b: String = ""
val c: Boolean = false,
val d: Boolean = false,
val e: String = ""
) {
class Builder {
private var bA: String = ""; fun a(block: () -> String) { bA = block() }
private var bB: String = ""; fun b(block: () -> String) { bB = block() }
private var bC: String = ""; fun c(block: () -> String) { bC = block() }
private var bD: String = ""; fun d(block: () -> String) { bD = block() }
private var bE: String = ""; fun e(block: () -> String) { bE = block() }
fun build(): FooBar = FooBar(bA, bB, bC, bD, bE)
}
companion object {
inline fun builder(block: Builder.() -> Unit): FooBar = Builder().apply(block).build()
}
}
About 3 min
Date
private const val TIME_STAMP_FORMAT = "EEEE. MMM d, yyyy - hh:mm:ss a"
private const val DATE_FORMAT = "yyyy-MM-dd"
fun Long.getTimeStamp(): String {
val date = Date(this)
val simpleDateFormat = SimpleDateFormat(TIME_STAMP_FORMAT, Locale.getDefault())
simpleDateFormat.timeZone = TimeZone.getDefault()
return simpleDateFormat.format(date)
}
fun Long.getYearMonthDay(): String {
val date = Date(this)
val simpleDateFormat = SimpleDateFormat(DATE_FORMAT, Locale.getDefault())
simpleDateFormat.timeZone = TimeZone.getDefault()
return simpleDateFormat.format(date)
}
@Throws(ParseException::class)
fun String.getDateUnixTime(): Long {
try {
val simpleDateFormat = SimpleDateFormat(DATE_FORMAT, Locale.getDefault())
simpleDateFormat.timeZone = TimeZone.getDefault()
return simpleDateFormat.parse(this)!!.time
} catch (e: ParseException) {
e.printStackTrace(0)
}
throw ParseException("Please Enter a valid date", 0)
}
val currentTime = System.currentTimeMillis()
println(currentTime.getTimeStamp())
// Sunday, September 20, 2020 - 10:48:26 AM
println(currentTime.getYearMonthDay())
// 2020-09-20
println("2020-09-20".getDateUnixTime())
// 1600549200000
Less than 1 minute