本文整理汇总了C#中Date.getTime方法的典型用法代码示例。如果您正苦于以下问题:C# Date.getTime方法的具体用法?C# Date.getTime怎么用?C# Date.getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date.getTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DateRange
public DateRange(Date lower, Date upper)
: base((double) lower.getTime(), (double) upper.getTime())
{
DateRange dateRange = this;
this.lowerDate = lower.getTime();
this.upperDate = upper.getTime();
}
示例2: FixedMillisecond
public FixedMillisecond(Date time)
{
FixedMillisecond fixedMillisecond = this;
this.time = time.getTime();
}
示例3: DurationBetween
/// <summary>
/// Return the duration between two dates. If either date is null a duration of 0 is returned.
/// </summary>
/// <param name="start">start date</param>
/// <param name="finish">end date</param>
/// <returns>duration between the dates (or duration of 0 if either date is null)</returns>
private static Duration DurationBetween(Date start, Date finish)
{
double duration = 0;
if(start != null && finish != null)
{
duration = finish.getTime() - start.getTime();
}
return Duration.getInstance(duration / 1000 / 60 / 60 / 24, TimeUnit.DAYS);
}
示例4: RelativeDateFormat
public RelativeDateFormat(Date time)
: this(time.getTime())
{
}
示例5: format
public virtual StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
{
long num1 = date.getTime() - this.baseMillis;
string str;
if (num1 < 0L)
{
num1 *= -1L;
str = "-";
}
else
str = this.positivePrefix;
long num2 = num1;
long num3 = RelativeDateFormat.MILLISECONDS_IN_ONE_DAY;
long num4 = -1L;
long num5 = num3 != num4 ? num2 / num3 : -num2;
long num6 = num1 - num5 * RelativeDateFormat.MILLISECONDS_IN_ONE_DAY;
long num7 = num6;
long num8 = RelativeDateFormat.MILLISECONDS_IN_ONE_HOUR;
long num9 = -1L;
long num10 = num8 != num9 ? num7 / num8 : -num7;
long num11 = num6 - num10 * RelativeDateFormat.MILLISECONDS_IN_ONE_HOUR;
long num12 = num11 / 60000L;
double num13 = (double) (num11 - num12 * 60000L) / 1000.0;
toAppendTo.append(str);
if (num5 != 0L || this.showZeroDays)
toAppendTo.append(new StringBuffer().append(this.dayFormatter.format(num5)).append(this.getDaySuffix()).toString());
if (num10 != 0L || this.showZeroHours)
toAppendTo.append(new StringBuffer().append(this.hourFormatter.format(num10)).append(this.getHourSuffix()).toString());
toAppendTo.append(new StringBuffer().append(this.minuteFormatter.format(num12)).append(this.getMinuteSuffix()).toString());
toAppendTo.append(new StringBuffer().append(this.secondFormatter.format(num13)).append(this.getSecondSuffix()).toString());
return toAppendTo;
}
示例6: FromJavaDate
/// <summary>
/// Converts a Java Date value to a DateTime value
/// </summary>
/// <param name="javaDate">The Java date</param>
/// <returns></returns>
private static DateTime FromJavaDate(Date javaDate)
{
if (_configTimeZone == null)
{
// Read time zone from market-hours-config
var symbol = Symbol.Create("*", SecurityType.Forex, Market.FXCM);
_configTimeZone = MarketHoursDatabase.FromDataFolder().GetDataTimeZone(symbol.ID.Market, symbol, symbol.ID.SecurityType);
}
// Convert javaDate to UTC Instant (Epoch)
var instant = Instant.FromMillisecondsSinceUnixEpoch(javaDate.getTime());
// Convert to configured TZ then to a .Net DateTime
return instant.InZone(_configTimeZone).ToDateTimeUnspecified();
}