Skip to content

Instantly share code, notes, and snippets.

@dlwyatt
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlwyatt/8edc4ff21a22ba50eb74 to your computer and use it in GitHub Desktop.
Save dlwyatt/8edc4ff21a22ba50eb74 to your computer and use it in GitHub Desktop.
Date / Time parsing
$line = Get-Content C:\Karl\ATM-E-DocsEmailproatm.log -tail 1
if ($line -match '\d{2}/\d{2}/\d{2}\s+\d{2}:\d{2}:\d{2}')
{
$dateTime = [datetime]$matches[0]
}
else
{
throw "Line '$line' does not contain a date / time in the expected format."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment