/
_kpblc-conv-date-to-format.lsp
39 lines (39 loc) · 1.52 KB
/
_kpblc-conv-date-to-format.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(defun _kpblc-conv-date-to-format (str / cd tmp ms)
;|
* Êîíâåðòàöèÿ òåêóùåé äàòû ïî óêàçàííîìó ôîðìàòó
* Ïàðàìåòðû âûçîâà:
str òèï ôîðìàòà
yyyy - ãîä
yy - ãîä
mo - ìåñÿö
m - ìåñÿö
dd - äåíü
hh - ÷àñ
mm - ìèíóòû
ss - ñåêóíäû
sec - ñåêóíäû
msec - ìèëëèñåêóíäû
* Ïðèìåðû âûçîâà:
(_kpblc-conv-date-to-format "(yyyy.m.dd[hh.mm.sec])")
(_kpblc-conv-date-to-format "(yyyy.mo.dd[hh.mm.sec.msec])")
|;
(setq cd (_kpblc-get-date-as-string))
(foreach item (list (cons "yyyy" (substr cd 1 4))
(cons "msec" (substr cd 16))
(cons "MSEC" (substr cd 16))
(cons "sec" (substr cd 14 2))
(cons "yy" (substr cd 3 2))
(cons "mm" (substr cd 12 2))
(cons "mo" (substr cd 5 2))
(cons "m" (vl-string-left-trim "0" (substr cd 5 2)))
(cons "yy" (substr cd 3 2))
(cons "dd" (substr cd 7 2))
(cons "hh" (substr cd 10 2))
(cons "ss" (substr cd 14 2))
) ;_ end of list
(if (> (length (setq tmp (_kpblc-conv-string-to-list str (car item)))) 1)
(setq str (_kpblc-conv-list-to-string tmp (cdr item)))
) ;_ end of if
) ;_ end of foreach
str
) ;_ end of defun