Add time library
This commit is contained in:
parent
05118ba453
commit
9c2e5ca79c
1 changed files with 26 additions and 0 deletions
26
src/lib/time.lisp
Normal file
26
src/lib/time.lisp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
(defpackage #:hp/lib/time
|
||||||
|
(:use #:cl)
|
||||||
|
(:import-from #:local-time
|
||||||
|
#:reread-timezone-repository
|
||||||
|
#:find-timezone-by-location-name
|
||||||
|
#:parse-timestring
|
||||||
|
#:format-timestring)
|
||||||
|
(:export #:datetime
|
||||||
|
#:jp-datetime))
|
||||||
|
(in-package #:hp/lib/time)
|
||||||
|
|
||||||
|
(reread-timezone-repository)
|
||||||
|
(setf local-time:*default-timezone*
|
||||||
|
(find-timezone-by-location-name "Asia/Tokyo"))
|
||||||
|
|
||||||
|
(defun datetime (timestring)
|
||||||
|
(format-timestring nil
|
||||||
|
(parse-timestring timestring)
|
||||||
|
:format '(:year "-" (:month 2) "-" (:day 2) " "
|
||||||
|
(:hour 2) ":" (:min 2))))
|
||||||
|
|
||||||
|
(defun jp-datetime (timestring)
|
||||||
|
(format-timestring nil
|
||||||
|
(parse-timestring timestring)
|
||||||
|
:format '(:year "年" :month "月" :day "日" " "
|
||||||
|
:hour "時" :min "分")))
|
Loading…
Add table
Add a link
Reference in a new issue