Re: [問題] 在文字編輯中插入現在時間
※ 引述《bennyaous (fortune | cowsay)》之銘言:
: set {year:y, month:m, day:d} to now
: set t to time string of now
: set m to text -2 through -1 of ("0" & m * 1)
: set d to text -2 through -1 of ("0" & d)
: set the clipboard to (y & "/" & m & "/" & d as string) & " " & t
: delay 0.1
: tell application "System Events" to keystroke "v" using command down
: 註2:
: 秒數可用 text 1 through -4 去掉,不過牽涉到 12/24 小時的顯示設定,
: 有 AM/PM 的話可能要用 set t to text 1 through -7 of time string of now
要做高級格式客制的話用 shell 的 date 比較快
set datetime to do shell script "date +" & quoted form of "%Y-%m-%d %H:%M"
set the clipboard to datetime
delay 0.1
tell application "System Events" to keystroke "v" using command down
這個會出現 2012-12-10 21:20 (我打文章的時間)
http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/
這裡面有完整的可用格式符
幾乎要什麼格式都行了
--
作者 Linux (Windows) 看板 C_and_CPP
標題 [問題] 如何確認是否 free 對記憶體
時間 Fri Nov 2 00:14:03 2012
→
11/02 00:43,
11/02 00:43
→
11/02 00:44,
11/02 00:44
→
11/02 00:45,
11/02 00:45
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.81.146
※ 編輯: uranusjr 來自: 114.32.81.146 (12/10 21:22)
→
12/11 13:28, , 1F
12/11 13:28, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 5 篇):