Here is a simple example page that shows a few different ways to declare global variables: http://docs.testplant.com/?q=content/global-variables
You can either formally declare them at the beginning of a handler, or you can declare them in-line.
To change the date format to MM/DD/YYYY, you will need to set the date property of the timeformat global property to “%m/%d/%Y”, like this:
put the timeformat.date -- puts "%m/%d/%y"
put the date -- puts "09/30/14"
set the timeformat.date to "%m/%d/%Y"
put the date -- puts "09/30/2014"
You can also use the pre-defined variable “Today” to reference today’s date, but it uses the international date format “%Y-%m-%d”, and that would have to be formatted separately. For instance, if I execute
The result displayed is “2014-09-30”. In case you are interested, you can see a list of all the constants and pre-defined variables here: http://docs.testplant.com/?q=content/values#constants
For more information on how to customize time and date formats, please see The TimeFormat global property under “Working with Dates and Times” here: http://docs.testplant.com/?q=content/working-dates-and-times#the-timeformat