擅长:python、mysql、java
<p>使用datetime对象的<a href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior" rel="noreferrer">^{<cd1>}</a>函数:</p>
<pre><code>import datetime
now = datetime.datetime.now()
date_string = now.strftime('%Y-%m-%d')
print(date_string)
</code></pre>
<p><strong>输出</strong></p>
<pre><code>'2016-01-26'
</code></pre>