Do not use the system based DateTime.Now property.
When executing the same script on a Core S and on an LCE the time is different:
The LCE will use the local time. The Core S will use UTC.
But also do not use the system based DateTime.UTCNow property.
This would be the same on both machines, but would differ to the local time, which is used and displayed in Sympholight.
And on Windows Sympholight can have a different local time than the system.
So like in the Workflow use ProjectInformation.DateTime. You can access it, using the old scripting interface.
Use the ContentObjectAccessor in order to get the ProjectInformation object. Then just get the DateTime property:
#region usings
using Scripting; // The deprecated scripting API necessary to access ActionPad and Effects.
using Ecue.Contracts;
using Ecue.Contracts.Workflow;
using Ecue.Contracts.UserAccess;
using Ecue.Contracts.Scheduler;
using Ecue.Contracts.Rdm;
using Ecue.Contracts.Logging;
using Ecue.Contracts.Dmx;
using Ecue.Contracts.Exceptions;
using Ecue.Contracts.Devices;
using Ecue.Contracts.Content;
using Ecue.Contracts.Content.Effects;
using Ecue.Sympholight.Scripting.Api;
using System;
#endregion
using Scripting; // The deprecated scripting API necessary to access ActionPad and Effects.
using Ecue.Contracts;
using Ecue.Contracts.Workflow;
using Ecue.Contracts.UserAccess;
using Ecue.Contracts.Scheduler;
using Ecue.Contracts.Rdm;
using Ecue.Contracts.Logging;
using Ecue.Contracts.Dmx;
using Ecue.Contracts.Exceptions;
using Ecue.Contracts.Devices;
using Ecue.Contracts.Content;
using Ecue.Contracts.Content.Effects;
using Ecue.Sympholight.Scripting.Api;
using System;
#endregion
/// <summary>
/// This class is public static, so it's methods can be accessed from the workflow designer.
/// </summary>
public static class Script1
{
/// <summary>
/// This method is public static, so it can be accessed from the workflow designer.
/// </summary>
public static void Run()
{
// Use "ecue." to access SYMPHOLIGHT scripting functionality
ecue.Logging.Info("This is a test log message generated by your script.");
ProjectInformation projInfo = (ProjectInformation)ContentObjectAccessor.GetObject("ProjectInformation");
var dt = projInfo.DateTime;
}
}
/// This class is public static, so it's methods can be accessed from the workflow designer.
/// </summary>
public static class Script1
{
/// <summary>
/// This method is public static, so it can be accessed from the workflow designer.
/// </summary>
public static void Run()
{
// Use "ecue." to access SYMPHOLIGHT scripting functionality
ecue.Logging.Info("This is a test log message generated by your script.");
ProjectInformation projInfo = (ProjectInformation)ContentObjectAccessor.GetObject("ProjectInformation");
var dt = projInfo.DateTime;
}
}
Then you work with the same time used in the Application and the user interface.
This is possible by formatting Date and Time Output.
You also need to consider the used culture. With the correct culture, names of days or months will be displayed in the correct language.
We have added two projects, that demonstrate
- usage of the correct Date object
- formatting time output
- using different cultures
- splitting strings by script
Of course you can upload the projects on your Core S in order to check, how iti looks like on a Core S ActionPad.