Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

Browse by Tags

All Tags » DateTime   (RSS)

Hey PowerShell Guy !,How Can I Separate The Month From the Year in a Date String Like 122007?

How Can I Separate The Month From the Year in a Date String Like 122007? [datetime]::ParseExact(122007,'Myyyy',$null) | ft Month,Year You can see you can use ParseExact to convert a custom format to d dateTime OBject from there it is simple of course
Posted by MoW | 3 Comments
Filed under: , ,

Hey, PowerShell Guy, how to translate a Unix timestamp to a local time ?

This time not a translation from a Hey scriptingguy article, but a question that just came up in the #powerShell IRC channel, how to convert a Unix timestamp to a local datetime ? A Unix Timestamp is expressed in seconds since 1 January 1970 in UTC time,
Posted by MoW | 1 Comments
Filed under: , ,

PoSH Challenge Part 14

# Level 15 (1..99 |% {"1${_}6"} |? {[datetime]::IsleapYear($_)} |? {([datetime]"01/26/$_").dayofweek -eq 'Monday'} )[-2] Enjoy, Greetings /\/\o\/\/
Posted by MoW | 0 Comments

PowerShell get-Worldtime function

As we are running for a new year again,Some more timeZone fun, I did a WMI example here : Hey PowerShell Guy!, How Can I Retrieve Time Zone Information for a Computer? , now I show an example that shows the given date in all timezones with information
Posted by MoW | 3 Comments

Hey, PowerShell Guy!, How do you know it's Morning or evening ?

I Paste the following into the Consolewindow : switch (get-date -Format tt) { 'AM' {'It is morning time.'} 'PM' {'It is afternoon/evening time.'} } A variation on the Hey Scripting Guy article : How Can I Tell If a Time Occurred in the Morning or the
Posted by MoW | 2 Comments
Filed under: ,

Hey, PowerShellGuy ! : I have to move files based on date now too !

The Chat did go on while I made Last blog entry PowerShell : the power of REPL, -WhatIf and ScriptBlocks as Parameter when moving files : [22:29] <generalhan> ok now time to work on something a bit harder ! ... [22:29] <generalhan> i have

Hey, PowerShell Guy ! How Can I Get the Uptime of a Service?

And another Hey, Scripting Guy ! translation to powerShell How Can I Get the Uptime of a Service? The PowerShell translation : $s = gwmi win32_service - filter " name = 'spooler' " " {0} " - f (( get-date ) - ([wmi] '' ).ConvertToDateTime((gwmi Win32_Process

Hey, PowerShell Guy ! How Can I Tell If a Script is Running on the First or Second Monday of a Month?

Scripting games are over, but if you want some more PowerShell execersises , the rest of the scriptcenter including VbScript content might be usefull also. As you might know, I also like to translate Hey Scripting Guy questions to PowerShell (For a list
Posted by admin | 3 Comments
Filed under: , ,

Never, Ever on a Sum Day

List 100 sumday's after 1-1-2000 (See : 2007 Winter Scripting Games Program page 17 and 23 ) My PoSH solution : $sumdays = 0 $dt = [datetime] '2000-1-1' while ($sumdays -lt 100 ) { $dt = $dt.AddDays( 1 ) if ($dt.day + $dt.month -eq $dt.ToString( 'yy'
Posted by MoW | 0 Comments