当前位置: 首页>>代码示例>>C++>>正文


C++ DateComponents::toString方法代码示例

本文整理汇总了C++中DateComponents::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ DateComponents::toString方法的具体用法?C++ DateComponents::toString怎么用?C++ DateComponents::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateComponents的用法示例。


在下文中一共展示了DateComponents::toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serializeWithComponents

String BaseDateAndTimeInputType::serializeWithComponents(const DateComponents& date) const
{
    Decimal step;
    if (!element()->getAllowedValueStep(&step))
        return date.toString();
    if (step.remainder(msecPerMinute).isZero())
        return date.toString(DateComponents::None);
    if (step.remainder(msecPerSecond).isZero())
        return date.toString(DateComponents::Second);
    return date.toString(DateComponents::Millisecond);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: serializeWithComponents

String BaseDateAndTimeInputType::serializeWithComponents(const DateComponents& date) const
{
    double step;
    if (!element()->getAllowedValueStep(&step))
        return date.toString();
    if (!fmod(step, msecPerMinute))
        return date.toString(DateComponents::None);
    if (!fmod(step, msecPerSecond))
        return date.toString(DateComponents::Second);
    return date.toString(DateComponents::Millisecond);
}
开发者ID:Moondee,项目名称:Artemis,代码行数:11,代码来源:BaseDateAndTimeInputType.cpp

示例3: sanitizeValue

String DateTimeInputType::sanitizeValue(const String& proposedValue) const
{
    DateComponents date;
    if (!parseToDateComponents(proposedValue, &date))
        return String();
    return date.toString();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: writeDocument

void CalendarPickerElement::writeDocument(DocumentWriter& writer)
{
    HTMLInputElement* input = hostInput();
    DateComponents date;
    date.setMillisecondsSinceEpochForDate(input->minimum());
    String minString = date.toString();
    date.setMillisecondsSinceEpochForDate(input->maximum());
    String maxString = date.toString();
    Decimal step;
    String stepString = input->fastGetAttribute(stepAttr);
    if (stepString.isEmpty() || !input->getAllowedValueStep(&step))
        stepString = "1";

    addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
    writer.addData(calendarPickerCss, sizeof(calendarPickerCss));
    if (document()->page()) {
        CString extraStyle = document()->page()->theme()->extraCalendarPickerStyleSheet();
        if (extraStyle.length())
            writer.addData(extraStyle.data(), extraStyle.length());
    }
    addString("</style></head><body><div id=main>Loading...</div><script>\n"
               "window.dialogArguments = {\n", writer);
    addProperty("min", minString, writer);
    addProperty("max", maxString, writer);
    addProperty("step", stepString, writer);
    addProperty("required", input->required(), writer);
    addProperty("currentValue", input->value(), writer);
    addProperty("locale", defaultLanguage(), writer);
    addProperty("todayLabel", calendarTodayText(), writer);
    addProperty("clearLabel", calendarClearText(), writer);
    addProperty("weekStartDay", firstDayOfWeek(), writer);
    addProperty("monthLabels", monthLabels(), writer);
    addProperty("dayLabels", weekDayShortLabels(), writer);
    Direction dir = direction(monthLabels()[0][0]);
    addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer);
    addString("}\n", writer);

    writer.addData(calendarPickerJs, sizeof(calendarPickerJs));
    addString("</script></body>\n", writer);
}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例5: valueToDateTimeString

static String valueToDateTimeString(double value, AtomicString type)
{
    DateComponents components;
    if (type == InputTypeNames::date)
        components.setMillisecondsSinceEpochForDate(value);
    else if (type == InputTypeNames::datetime_local)
        components.setMillisecondsSinceEpochForDateTimeLocal(value);
    else if (type == InputTypeNames::month)
        components.setMonthsSinceEpoch(value);
    else if (type == InputTypeNames::time)
        components.setMillisecondsSinceMidnight(value);
    else if (type == InputTypeNames::week)
        components.setMillisecondsSinceEpochForWeek(value);
    else
        ASSERT_NOT_REACHED();
    return components.type() == DateComponents::Invalid ? String() : components.toString();
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:17,代码来源:DateTimeChooserImpl.cpp


注:本文中的DateComponents::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。