Converting dates/times into ticks using the PowerShell Get-Date applet is simple. However, how do you do the opposite operation; converting the ticks back into a date and time?
[DateTime]10000000000
Monday, January 01, 0001 12:16:40 AM
Just cast the number into a DateTime
. The DateTime
single-parameter constructor takes a long
as number of ticks.
Note that you can use the Get-Date
cmdlet to also do the reverse operation:
PS> Get-Date 634141193308872671
Mittwoch, 7. Juli 2010 17:08:50
You can also use the New-Object cmdlet:
PS > get-date
Friday, July 09, 2010 12:01:42 AM
PS > (get-date).ticks
634142305097923801
PS > New-Object System.DateTime 634142305097923801
Friday, July 09, 2010 12:01:49 AM
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.