How to format DateTime in PowerShell window

PS C:/> "{0:M/d/yyyy}" -f ([datetime]::Today)

12/28/2010

 

PS C:/> ([datetime]::today).ToString("M/d/yyyy h:m:s tt")

12/29/2010 12:0:0 AM

  

PS C:/> $a|gm

    TypeName: System.DateTime

 

Name                 MemberType     Definition

----                 ----------     ----------

Add                  Method         System.DateTime Add(System.TimeSpan value)

AddDays              Method         System.DateTime AddDays(double value)

AddHours             Method         System.DateTime AddHours(double value)

AddMilliseconds      Method         System.DateTime AddMilliseconds(double v...

AddMinutes           Method         System.DateTime AddMinutes(double value)

AddMonths            Method         System.DateTime AddMonths(int months)

AddSeconds           Method         System.DateTime AddSeconds(double value)

AddTicks             Method         System.DateTime AddTicks(long value)

AddYears             Method         System.DateTime AddYears(int value)

CompareTo            Method         int CompareTo(System.Object value), int ...

Equals               Method         bool Equals(System.Object value), bool E...

GetDateTimeFormats   Method         string[] GetDateTimeFormats(), string[] ...

GetHashCode          Method         int GetHashCode()

GetType              Method         type GetType()

GetTypeCode          Method         System.TypeCode GetTypeCode()

IsDaylightSavingTime Method         bool IsDaylightSavingTime()

Subtract             Method         System.TimeSpan Subtract(System.DateTime...

ToBinary             Method         long ToBinary()

ToFileTime           Method         long ToFileTime()

ToFileTimeUtc        Method         long ToFileTimeUtc()

ToLocalTime          Method         System.DateTime ToLocalTime()

ToLongDateString     Method         string ToLongDateString()

ToLongTimeString     Method         string ToLongTimeString()

ToOADate             Method         double ToOADate()

ToShortDateString    Method         string ToShortDateString()

ToShortTimeString    Method         string ToShortTimeString()

ToString             Method         string ToString(), string ToString(strin...

ToUniversalTime      Method         System.DateTime ToUniversalTime()

Date                 Property       System.DateTime Date {get;}

Day                  Property       System.Int32 Day {get;}

DayOfWeek            Property       System.DayOfWeek DayOfWeek {get;}

DayOfYear            Property       System.Int32 DayOfYear {get;}

Hour                 Property       System.Int32 Hour {get;}

Kind                 Property       System.DateTimeKind Kind {get;}

Millisecond          Property       System.Int32 Millisecond {get;}

Minute               Property       System.Int32 Minute {get;}

Month                Property       System.Int32 Month {get;}

Second               Property       System.Int32 Second {get;}

Ticks                Property       System.Int64 Ticks {get;}

TimeOfDay            Property       System.TimeSpan TimeOfDay {get;}

Year                 Property       System.Int32 Year {get;}

DateTime             ScriptProperty System.Object DateTime {get=if ((& { Set...

 

http://lovephoenix.javaeye.com/blog/661380个人因为有用的资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值