lib/connection/result/sf_timestamp.js
function SfTimestamp(epochSeconds, nanoSeconds, scale, timezone, format)
{
  // pick reasonable defaults for the inputs if needed
  epochSeconds = Util.isNumber(epochSeconds) ? epochSeconds : 0;
  nanoSeconds = Util.isNumber(nanoSeconds) ? nanoSeconds : 0;
  scale = Util.isNumber(scale) ? scale : 0;
  format = Util.isString(format) ? format : '';

  // save any information we'll need later
  this.epochSeconds = epochSeconds;
  this.nanoSeconds = nanoSeconds;
  this.scale = scale;
  this.timezone = timezone;
  this.format = format;

  // compute the epoch milliseconds and create a moment object from them
  var moment = Moment((epochSeconds * 1000) + (nanoSeconds / 1000000));

  // set the moment's timezone
  if (Util.isString(timezone))
  {
    moment = moment.tz(timezone);
  }
  else if (Util.isNumber(timezone))
  {
    moment = moment.utcOffset(timezone);
  }

  // save the moment
  this.moment = moment;
}
function SfTimestamp(epochSeconds, nanoSeconds, scale, timezone, format)
{
  // pick reasonable defaults for the inputs if needed
  epochSeconds = Util.isNumber(epochSeconds) ? epochSeconds : 0;
  nanoSeconds = Util.isNumber(nanoSeconds) ? nanoSeconds : 0;
  scale = Util.isNumber(scale) ? scale : 0;
  format = Util.isString(format) ? format : '';

  // save any information we'll need later
  this.epochSeconds = epochSeconds;
  this.nanoSeconds = nanoSeconds;
  this.scale = scale;
  this.timezone = timezone;
  this.format = format;

  // compute the epoch milliseconds and create a moment object from them
  var moment = Moment((epochSeconds * 1000) + (nanoSeconds / 1000000));

  // set the moment's timezone
  if (Util.isString(timezone))
  {
    moment = moment.tz(timezone);
  }
  else if (Util.isNumber(timezone))
  {
    moment = moment.utcOffset(timezone);
  }

  // save the moment
  this.moment = moment;
}
function SfTimestamp ( epochSeconds , nanoSeconds , scale , timezone , format ) { // pick reasonable defaults for the inputs if needed epochSeconds = Util . isNumber ( epochSeconds ) ? epochSeconds : 0 ; nanoSeconds = Util . isNumber ( nanoSeconds ) ? nanoSeconds : 0 ; scale = Util . isNumber ( scale ) ? scale : 0 ; format = Util . isString ( format ) ? format : '' ; // save any information we'll need later this . epochSeconds = epochSeconds ; this . nanoSeconds = nanoSeconds ; this . scale = scale ; this . timezone = timezone ; this . format = format ; // compute the epoch milliseconds and create a moment object from them var moment = Moment ( ( epochSeconds * 1000 ) + ( nanoSeconds / 1000000 ) ) ; // set the moment's timezone if ( Util . isString ( timezone ) ) { moment = moment . tz ( timezone ) ; } else if ( Util . isNumber ( timezone ) ) { moment = moment . utcOffset ( timezone ) ; } // save the moment this . moment = moment ; }
Creates a new SfTimestamp instance.

@param {Number} epochSeconds the epoch time in seconds.
@param {Number} nanoSeconds the number of nano seconds (incremental, not
epoch).
@param {Number} scale the precision for the fractional part of the timestamp.
@param {String | Number} [timezone] the timezone name as a string
(e.g. 'America/New_York') or the timezone offset in minutes (e.g. -240).
@param {String} [format] the SQL format to use to format the timestamp.
@constructor
Creates a new SfTimestamp instance .