2009年4月29日星期三

Ruby:string to date Or date to string

Ruby:string to date Or date to string
#string to date:
str="2009-02-02"
date=Date.strptime(str,"%Y-%m-%d")
#date to string:
date=Date.new(2009,2,2)
str=date.strftime("%Y-%m-%d")

没有评论:

发表评论