Skip to content

ToDate() function

the ToDate function takes a time.Time type variable as parameter, and returns a native JavaScript Date() object. Very useful to turn various timestamps returned by other SyncJS functions into an easier-to-use native JavaScript Date type.

ts
{
  var str = StatFileSystemObject("/home/myself/Documents/brochure.pdf");
  if !(str.Name == "") {
    var ts = ToDate(str.TimeStamp)
    // Use ts as any other native JavaScript Date() object
  }
}