Skip to content

Instantly share code, notes, and snippets.

@ShinjiKobayashi
Created November 27, 2015 04:54
Show Gist options
  • Save ShinjiKobayashi/bc96610bf18819e0e94f to your computer and use it in GitHub Desktop.
Save ShinjiKobayashi/bc96610bf18819e0e94f to your computer and use it in GitHub Desktop.
日付をファイル名にするやつ
class Sample(){
private val writer: PrintWriter by lazy {
val name = SimpleDateFormat("yyyyMMdd_HHmmss'.log'").format(Date(System.currentTimeMillis()))
PrintWriter(BufferedWriter(FileWriter(File("${Environment.getExternalStorageDirectory()}/$name"))))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment