Unix timestamp in powershell

I was a bit playing with powershell. I wanted to know the week of month, day of weeks, and other gems. It is chockingly easy !

Unix Timestamp :
PS> get-date -uformat %s
1329322194.18894

To get the day of week as number, you can chose between [int](get-date).dayofweek and get-date -uformat %u

What does uformat stand for ? Unix Format ! This is probably why powershell is so good, they integrated all unix and .net goodies in one tool 🙂

Ok, one more, get the week of month :
PS> (Get-WmiObject Win32_LocalTime).weekinmonth
3

1 thought on “Unix timestamp in powershell

  1. Pingback: Laurent Schneider » Powershell and dates

Comments are closed.