The value of DateTime will different depending on how the variable is declared
Lack of understanding how script variables declarations work
Local Datetime variables are local and known only to the Script program or function, and are initialized to the current local date-time value of the sever in which they execute.
Unlike local variables, Binding variables, including Input, Output and Public variables, are not touched by the Script engine by default. The SBO system uses the 1/1/1970 date, and the Script simply uses that. If one wants to use a different initial value, one can set the initial value and apply it.