Convert a <code>long</code> datetime from the given time scale to the universal time scale.

@param otherTime The <code>long</code> datetime
@param timeScale The time scale to convert from

@return The datetime converted to the universal time scale
769604
public static long from(long otherTime, int timeScale)
    {
        TimeScaleData data = fromRangeCheck(otherTime, timeScale);
                
        return (otherTime + data.epochOffset) * data.units;
    }
375990
public LocalDateTime toLocalDateTime(String s) throws SQLException {
    if (s == null) {
      return null;
    }

    int slen = s.length();

    // convert postgres's infinity values to internal infinity magic value
    if (slen == 8 && s.equals("infinity")) {
      return LocalDateTime.MAX;
    }

    if (slen == 9 && s.equals("-infinity")) {
      return LocalDateTime.MIN;
    }

    ParsedTimestamp ts = parseBackendTimestamp(s);

    // intentionally ignore time zone
    // 2004-10-19 10:23:54+03:00 is 2004-10-19 10:23:54 locally
    LocalDateTime result = LocalDateTime.of(ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second, ts.nanos);
    if (ts.era == GregorianCalendar.BC) {
      return result.with(ChronoField.ERA, IsoEra.BCE.getValue());
    } else {
      return result;
    }
  }
1222929
private BigDecimal getLongitudeHour(Calendar date, Boolean isSunrise) {
        int offset = 18;
        if (isSunrise) {
            offset = 6;
        }
        BigDecimal dividend = BigDecimal.valueOf(offset).subtract(getBaseLongitudeHour());
        BigDecimal addend = divideBy(dividend, BigDecimal.valueOf(24));
        BigDecimal longHour = getDayOfYear(date).add(addend);
        return setScale(longHour);
    }
934103
public static long getMonthEndTime(final long time) {
        final Calendar end = Calendar.getInstance();
        end.setTimeInMillis(getDayStartTime(time));
        end.set(Calendar.DAY_OF_MONTH, end.getActualMaximum(Calendar.DAY_OF_MONTH));
        end.set(Calendar.HOUR, 23);
        end.set(Calendar.MINUTE, 59);
        end.set(Calendar.SECOND, 59);
        end.set(Calendar.MILLISECOND, 999);

        return end.getTimeInMillis();
    }
777420
public function timespan($other = null, $timezone = null)
    {
        if (!$other instanceof DateTimeInterface) {
            $other = static::parse($other, $timezone);
        }

        return $this->diffForHumans($other, [
            'join' => ', ',
            'syntax' => CarbonInterface::DIFF_ABSOLUTE,
            'options' => CarbonInterface::NO_ZERO_DIFF,
            'parts' => -1,
        ]);
    }
249412
public T toDateTimeWithTimeZone(String dateTime) {
    return toDateTime(
        ISODateTimeFormat.dateTimeParser().withOffsetParsed().parseDateTime(dateTime));
  }
1371085
function(scale) {
        for (var i = 0; i < TL.BigDate.SCALES.length; i++) {
            if (TL.BigDate.SCALES[i][0] == scale) {
                var floored = TL.BigDate.SCALES[i][2](this.data.date_obj);
                return new TL.BigDate(floored);
            }
        };

        throw new TL.Error("invalid_scale_err", scale);
    }
3293
@Override
    public ChronoLocalDateTime<D> with(TemporalAdjuster adjuster) {
        return toLocalDate().getChronology().ensureChronoLocalDateTime(super.with(adjuster));
    }
352692
private String convertDateTime(long dt, String format)
    {
        if(format.length() == 0)
            format = Formats.DATETIME_FORMAT;
        return FormatUtilities.getFormattedDateTime(dt, format, false, 0L);
    }
460162
function toTimestamp(scale, input) {
	var adapter = scale._adapter || defaultAdapter;
	var options = scale.options.time;
	var parser = options.parser;
	var format = parser || options.format;
	var value = input;

	if (typeof parser === 'function') {
		value = parser(value);
	}

	// Only parse if its not a timestamp already
	if (typeof value !== 'number' && !(value instanceof Number) || !isFinite(value)) {
		value = typeof format === 'string'
			? adapter.parse(value, format)
			: adapter.parse(value);
	}

	if (value !== null) {
		return +value;
	}

	// Labels are in an incompatible format and no `parser` has been provided.
	// The user might still use the deprecated `format` option for parsing.
	if (!parser && typeof format === 'function') {
		value = format(input);

		// `format` could return something else than a timestamp, if so, parse it
		if (typeof value !== 'number' && !(value instanceof Number) || !isFinite(value)) {
			value = adapter.parse(value);
		}
	}

	return value;
}
132821
def strptime(cls, data, format, scale=DEFAULT_SCALE):  # pragma: no cover
        
        return cls(datetime.strptime(data, format), scale=scale)
953108
public static RelativeDateTimeFormatter getInstance(ULocale locale) {
        return getInstance(locale, null, Style.LONG, DisplayContext.CAPITALIZATION_NONE);
    }
1183912
public static long getDayEndTime(final long time) {
        final Calendar end = Calendar.getInstance();
        end.setTimeInMillis(time);
        final int year = end.get(Calendar.YEAR);
        final int month = end.get(Calendar.MONTH);
        final int day = end.get(Calendar.DATE);
        end.set(year, month, day, 23, 59, 59);
        end.set(Calendar.MILLISECOND, 999);

        return end.getTimeInMillis();
    }
940561
public PrettyTime setLocale(Locale locale)
   {
      if (locale == null)
         locale = Locale.getDefault();

      this.locale = locale;
      for (TimeUnit unit : units.keySet()) {
         if (unit instanceof LocaleAware)
            ((LocaleAware<?>) unit).setLocale(locale);
      }
      for (TimeFormat format : units.values()) {
         if (format instanceof LocaleAware)
            ((LocaleAware<?>) format).setLocale(locale);
      }
      return this;
   }
305189
public static long millis(final String time, final String timeUnit) {
      return TIMEUNITS.get(timeUnit).toMillis(Long.parseLong(time));
   }
852167
def setTimescale( self, timescale ):
        
        self._timescale = timescale
        
        # show hour/minute scale
        if timescale == XGanttWidget.Timescale.Minute:
            self._cellWidth = 60 # (60 seconds)
            self._dateStart = QDate.currentDate()
            self._timeStart = QTime(0, 0, 0)
            
            self._dateEnd = QDate.currentDate()
            self._timeEnd = QTime(23, 59, 59)
            
        elif timescale == XGanttWidget.Timescale.Hour:
            self._cellWidth = 30 # (60 seconds / 2.0)
            
            self._dateStart = QDate.currentDate()
            self._timeStart = QTime(0, 0, 0)
            
            self._dateEnd = QDate.currentDate()
            self._timeEnd = QTime(23, 59, 59)
        
        # show day/hour scale
        elif timescale == XGanttWidget.Timescale.Day:
            self._cellWidth = 30 # (60 minutes / 2.0)
            
            self._dateStart = QDate.currentDate().addDays(-7)
            self._timeStart = QTime(0, 0, 0)
            
            self._dateEnd = QDate.currentDate().addDays(7)
            self._timeEnd = QTime(23, 59, 59)
558210
public String getDate(long time) {

        return CmsDateUtil.getDate(new Date(time), DateFormat.SHORT, m_locale);
    }