Python中標準模組datetime能夠將字串轉換為日期
Python代碼
from datetime import datetime
text = .2012-09-2012-09-2012-09% Y-%m -%d')
print(y)
z = datetime.now()
diff = z - y
diff = z - y
Java代碼 nice_z = datetime .strftime(z, '%A %B %d, %Y') print(nice_z) datetime. atetimedef parse_ymd(s): year_s, mon_s, day_s = s.split('-')
.