date 輸出每個月的日期? - Linux

Belly avatar
By Belly
at 2011-05-27T01:41

Table of Contents

※ 引述《Xphenomenon (啦 )》之銘言:
: 請教一下,我知道 date 可以知道目前的時間日期以及前後天等這類的資訊,
: 不知道它是否可以我給定它譬如: 2011年 2 月份,它會回傳給我 28 天;
: 給他 2008 年 2 月,他會回傳給我 29 天。不知道是否可以實現?謝謝!

換個方式思考
$> date --date='2008/3/1 -1 day'
五 2月 29 00:00:00 CST 2008

$ date --date='2009/3/1 -1 day'
六 2月 28 00:00:00 CST 2009


--
Tags: Linux

All Comments

Kristin avatar
By Kristin
at 2011-05-31T19:40
你要先用一個步驟得到下個月的月份數字才行.
Ina avatar
By Ina
at 2011-06-02T02:51
還有年份切換問題XD
Tristan Cohan avatar
By Tristan Cohan
at 2011-06-06T13:39
不是 2008 +/- 4 * n 就一定是 29 天嗎?
Zanna avatar
By Zanna
at 2011-06-09T04:31
date --date='2008/3/1 -1 day' +%d 就是我要的,
感謝感謝!

ssh無法連線到自家主機的問題?

Dora avatar
By Dora
at 2011-05-26T23:53
連回自家主機如何正確的設定ip分享器? dns域名已開通(ping得到) 進入ip分享器設定虛擬伺服器 ip (區網第1台ip) 連接附範圍 21~23 協定 tcpandamp;udp ssh_config裡的port 22也開了 這樣不能遠端連線是哪裡有問題? - ...

Linux Mint 11 “Katya” released!

Isabella avatar
By Isabella
at 2011-05-26T22:25
官方發佈的消息如下面的網址 http://blog.linuxmint.com/?p=1760 請大家儘量使用 torrents 下載,有興趣的可以來玩玩看 若載點有問題,麻煩請告知,謝謝。 種子 http://linuxmint.ucla.tk/bt/linuxmint-11-gnome-dvd-32bi ...

date 輸出每個月的日期?

Thomas avatar
By Thomas
at 2011-05-26T22:24
其實跟coldnew的版本很像 部份簡化後附上簡易說明 如下: #!/bin/sh if [[ $1 == and#34;--helpand#34; ]]; then echo echo and#34;usage:and#34; echo echo and#34; mday --help ...

Buffer Overflow 產生的Segmentation Fault

Thomas avatar
By Thomas
at 2011-05-26T22:00
大家好, 小弟菜鳥正在學習緩衝(buffer)溢位(overflow)攻擊,依據書上的code想看看實 際運作情況…我知道Ubuntu至少有二種防止Buffer Overflow 的方式,所以我用了如下的 方式: Step 0: 關閉 random memory address scheme ...

ubuntu 的 make 不能用

Iris avatar
By Iris
at 2011-05-26T21:40
我的是 Ubuntu 10.10 我下載了一個 tar.gz的檔案 並且以 tar -zxvf 解壓縮好了 也確認資料夾中有 INSTALL Makefile 等等的檔案 但是每當我輸入 make 就會出現 make: *** No targets specified and no makefil ...