Dynamically update text value of Text Spline Object

I want a script that will get the DateTime from a Skylight object and update the text of a Text Spline Object.
I haven't written a script for C3D before, so I'm hoping to get some pointers here.

One basic question is what kind of script should I specify? I've started with Tag script.

Screen Shot 2019-10-28 at 5.04.27 PM.png

Below is what I have so far based on looking at some other scripts; but script doesn't show any visible changes.
(Of course, if the text value of the Text Spline Object can be dynamically set, than script could be modified to get parameters from any object, I suppose)

* Time of Day.js
* Created by Jerry McCreary at 10/28/19

function buildUI( tag ) {
    tag.addParameterLink("Skylight", true);

function applyParameters(tag){
    var owner=tag.owner();
    var doc=tag.document();
    var sun=tag.getParameter("Skylight");
    var txt = sun.getParameter('Date');
I've managed to get the datetime from the Skylight object and assign it to the Text Spline text value.

New question:
The value returned from the Skylight date parameter appears to be a float type.
Trying it as a millisecond value from epoch does not convert correctly to a Date object.

@Martin , how can I convert that to a Javascript Data object that matches the date and time in the Skylight text field? (i.e. month, day, hour, minute)

 * Time of Day.js
 * Created by Jerry McCreary at 10/28/19

function buildUI(tag) {
    tag.addParameterLink("Skylight", true);

function performExpression(tag) {

        var owner = tag.owner();
        var doc = tag.document();
        var sun = tag.getParameter("Skylight");
        var d;
        var dt;

        try {
            d = sun.getParameter('date');  // <-- ACTUAL value from Skylight
            dt = new Date(d);                  // <-- NOT an accurate date

            print("SUN DATE: "
                 + d.toString() + " "
                 + dt.getMonth().toString() + "/"
                 + dt.getDate().toString() + " "
                 + dt.getHours().toString() + ":" + dt.getMinutes().toString());

        } catch (err) {
            print("********* ERROR *********");

        owner.setParameter("text", d.toString());  // <-- ASSIGNING retrieved value to Text Spline



Well-known member
* Date seems to be an integer, starting from 0 (00:00 @ 01.01.yy) to some max value, 525 600 (24:00 @ 31.12.yy), ie number of minutes past New Year.
* No idea if that takes into account any leap years.
* Parsing that number into a proper date format is a bit awkward given the metrics of our calendar but essentially a set of trivial divisions and fiddling remainders.


Well-known member
* Note for testing:
* You can manually fiddle the f-curve for the date in the bottom panel for the timeline. As a matter of fact, you can simulate non-linear time, if this were useful in your project.
Thanks, Helmut.
I realized after posting my last question that some simple math would show me that the value is the number of minutes past New Year --- just as you point out.

To convert to JS Date object, this may work:

var sun_d = sun.getParameter('date');  // minutes since new year

var minutes = Math.floor(sun_d);
var seconds = 60 * (sun_d - minutes)
var d = new Date(2019, 0, 1, 0, minutes, seconds); // the actual year is not relevant
Then, the different parts of date can be extracted ... e.g. d.getMonth()
The value from the Skylight date field is a float, so it is possible to get seconds.

frank beckmann

Well-known member
That's cool. (y)
Is it possible to have just hh:mm:ss? I ask because we'd have then digital clocks.


PS. You might open a thread in the script general to release your script. ;)
Last edited: