Utilize PowerShell to Evaluate Natural Language Date Specifications

Follow

If users would like to test the use of natural language date specification without having to continue to type it into the Schedule Options area of a job, users can evaluate the date with a JAMS powershell commandlet called:


ConvertTo-Date


For example: ConvertTo-Date "Last Workday of Month +1" 


You can specify additional arguments for this evaluation, such as to specify which start date you wish to evaluate from.  Additional help is available using "Help ConvertTo-Date -full" at the powershell prompt.


--------------  Example 1 --------------
C:\PS>ConvertTo-Date "first day of month"

 

This command returns a DateTime object of the first day of the current month.

Friday, October 01, 2010 12:00:00 AM

 

--------------  Example 2 --------------

C:\PS>ConvertTo-Date yesterday -today 10/25/2007

 

This command gets yesterday's date as if today was October 25, 2007 so, the result is October 24, 2007.

 

Wednesday, October 24, 2007 12:00:00 AM

 


Have more questions? Submit a request

Comments