How many days until…

Rather than having to google/bing it, I thought I would write a really simply one-liner to find out how long until a certain date (Birthday, Christmas, etc).

So, the following command will prompt you for a date, and then tell you how long until we get there:

PSH [dropbox:\]: (get-date -date (read-host “How many days until”)) – (get-date)
How many days until: 1/6/2075

Days : 23027
Hours : 10
Minutes : 53
Seconds : 37
Milliseconds : 153
Ticks : 19895720171532698
TotalDays : 23027.4539022369
TotalHours : 552658.893653686
TotalMinutes : 33159533.6192212
TotalSeconds : 1989572017.15327
TotalMilliseconds : 1989572017153.27

Pretty simple, but I like Powershell for that reason!

Advertisements

Leave a comment

Filed under Microsoft, Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s