Referencing Dates in Expressions

GoldSim allows you to reference dates in expressions by enclosing the date in quotation marks within an expression. The format for referencing a date is determined by the Regional and Language time/date settings specified by the operating system.  For example, for a computer in the US, the following formats would all be valid ways for referencing October 1, 2009:

“10/1/2009”
“10-1-2009”
“October 1, 2009”
“1 October 2009”

   Note: You can include the time of day by adding hours:minutes:seconds to the string (e.g., “1 October 2009 13:30:00” would be 1:30 PM on 1 October 2009).

   Note: GoldSim provides two special units for displaying dates. If “date” or “datetime” are the assigned display units for an element, the value is displayed as a date (or a date and a time).

However, if you entered the same expressions on an Australian or European computer, although the last two examples would be interpreted as the 1st day in October, the first two examples (“10/1/2009” and “10-1-2009”) would be interpreted as the 10th day in January.  Similarly, on a German computer, “1 October 2009” would not even be recognized (GoldSim would display an error), but “1 Oktober 2009” would be correctly recognized and interpreted.

A date is internally converted and stored as a Julian time (in particular, the time since December 30, 1899 00:00:00). Hence, a date has dimensions of time.

Because dates are stored in this way, an expression could appear differently depending on the regional settings on the computer on which GoldSim is running.  For example, if you entered a date (say October 1, 2009) into GoldSim on a computer with US settings like this:

and then saved the file and subsequently opened the file on a computer with Australian or European settings, the same expression would appear like this:

In both cases, GoldSim would interpret the date as October 1, 2010.

You would typically reference a date in conjunction with DateTime, as shown below:

DateTime is a Run Property, and represents the simulated calendar time.

     Warning: You should take extra care when exchanging date information with other programs, such as Microsoft Excel, since they may treat Julian date references differently than GoldSim. Microsoft Excel, for example, actually uses a Julian reference date of December 31, 1899 00:00:00, but mistakenly adds an extra day into its calendar that did not actually exist (February 29, 1900).  Fortunately, as a result of this, the effective Julian date reference for all times after March 1, 1900 in Excel is actually the same as that used by GoldSim, December 30, 1899 00:00:00.

   Warning: If you enter a date using only two digits for the year (e.g., “10/1/09”), GoldSim interprets years less than or equal to 29 as being in the 21st century, and years greater than 29 as being in the 20th century. To avoid confusion, it is strongly recommended that you always use four digits to specify the year.

Related Topics…

Learn more about: