PowerTip of the Day-Adding and Subtracting Time

原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5560&elq=e4af9624a0344403b24bcf81d6722d83

原文:

There are actually two different ways of manipulating dates and times. Here is the high-level approach to subtract 30 days from today:

PS> (Get-Date) - (New-Timespan -day 30)

And here is an example that  offers  a more developer-centric approach:

PS> (Get-Date).AddDays(-30)

 

 

翻译:

操作时间有两种不同的方法,以下方式是高级(?)实现从今天减30天的方法。

PS> (Get-Date) - (New-Timespan -day 30)

下面的方法则是开发人员用的更多的方法:

PS> (Get-Date).AddDays(-30)

 

 

笔记:

两种方法的不同实现,powershell的和.net的。

posted @ 2010-07-12 17:10  哥本哈士奇(aspnetx)  阅读(372)  评论(1编辑  收藏  举报