String SparkTime::ISODateUTCString(uint32_t tnow) { uint32_t savedTimeZone = _timezone; bool savedUseDST = _useDST; _timezone = 0; _useDST = false; String ISOString; ISOString += yearString(tnow); ISOString += "-"; ISOString += monthString(tnow); ISOString += "-"; ISOString += dayString(tnow); ISOString += "T"; ISOString += hourString(tnow); ISOString += ":"; ISOString += minuteString(tnow); ISOString += ":"; ISOString += secondString(tnow); ISOString += "Z"; _timezone = savedTimeZone; _useDST = savedUseDST; return ISOString; }
String SparkTime::ISODateString(uint32_t tnow) { String ISOString; ISOString += yearString(tnow); ISOString += "-"; ISOString += monthString(tnow); ISOString += "-"; ISOString += dayString(tnow); ISOString += "T"; ISOString += hourString(tnow); ISOString += ":"; ISOString += minuteString(tnow); ISOString += ":"; ISOString += secondString(tnow); int32_t offset = timeZoneDSTOffset(tnow)/3600L; // Guard against timezone problems if (offset>-24 && offset<24) { if (offset < 0) { ISOString = ISOString + "-" + _digits[-offset] + "00"; } else { ISOString = ISOString + "+" + _digits[offset] + "00"; } } return ISOString; }
String timeStampString( ){ XString s; s.formatLong(year(),4); s+= '-'; s.formatLong(month(),2); s+= '-'; s.formatLong(day(),2); s+= 'T'; s+=hourString(); s+= "+0200"; return s; }
String timeStampString(int utcMinutesDifference){ XString s; s.formatLong(year(),4); s+= '-'; s.formatLong(month(),2); s+= '-'; s.formatLong(day(),2); s+= 'T'; s+=hourString(); if(utcMinutesDifference<0) { s += '-'; utcMinutesDifference += -1; }else{ s+= '+'; } s.formatLong(utcMinutesDifference/60,2); s.formatLong(utcMinutesDifference%60,2); // s+= "+0200"; return s; }
JSObject* IntlDateTimeFormat::resolvedOptions(ExecState& exec) { VM& vm = exec.vm(); auto scope = DECLARE_THROW_SCOPE(vm); // 12.3.5 Intl.DateTimeFormat.prototype.resolvedOptions() (ECMA-402 2.0) // The function returns a new object whose properties and attributes are set as if constructed by an object literal assigning to each of the following properties the value of the corresponding internal slot of this DateTimeFormat object (see 12.4): locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day, hour, minute, second, and timeZoneName. Properties whose corresponding internal slots are not present are not assigned. // Note: In this version of the ECMAScript 2015 Internationalization API, the timeZone property will be the name of the default time zone if no timeZone property was provided in the options object provided to the Intl.DateTimeFormat constructor. The previous version left the timeZone property undefined in this case. if (!m_initializedDateTimeFormat) { initializeDateTimeFormat(exec, jsUndefined(), jsUndefined()); ASSERT_UNUSED(scope, !scope.exception()); } JSObject* options = constructEmptyObject(&exec); options->putDirect(vm, vm.propertyNames->locale, jsNontrivialString(&exec, m_locale)); options->putDirect(vm, vm.propertyNames->calendar, jsNontrivialString(&exec, m_calendar)); options->putDirect(vm, vm.propertyNames->numberingSystem, jsNontrivialString(&exec, m_numberingSystem)); options->putDirect(vm, vm.propertyNames->timeZone, jsNontrivialString(&exec, m_timeZone)); if (m_weekday != Weekday::None) options->putDirect(vm, vm.propertyNames->weekday, jsNontrivialString(&exec, ASCIILiteral(weekdayString(m_weekday)))); if (m_era != Era::None) options->putDirect(vm, vm.propertyNames->era, jsNontrivialString(&exec, ASCIILiteral(eraString(m_era)))); if (m_year != Year::None) options->putDirect(vm, vm.propertyNames->year, jsNontrivialString(&exec, ASCIILiteral(yearString(m_year)))); if (m_month != Month::None) options->putDirect(vm, vm.propertyNames->month, jsNontrivialString(&exec, ASCIILiteral(monthString(m_month)))); if (m_day != Day::None) options->putDirect(vm, vm.propertyNames->day, jsNontrivialString(&exec, ASCIILiteral(dayString(m_day)))); if (m_hour != Hour::None) { options->putDirect(vm, vm.propertyNames->hour, jsNontrivialString(&exec, ASCIILiteral(hourString(m_hour)))); options->putDirect(vm, vm.propertyNames->hour12, jsBoolean(m_hour12)); } if (m_minute != Minute::None) options->putDirect(vm, vm.propertyNames->minute, jsNontrivialString(&exec, ASCIILiteral(minuteString(m_minute)))); if (m_second != Second::None) options->putDirect(vm, vm.propertyNames->second, jsNontrivialString(&exec, ASCIILiteral(secondString(m_second)))); if (m_timeZoneName != TimeZoneName::None) options->putDirect(vm, vm.propertyNames->timeZoneName, jsNontrivialString(&exec, ASCIILiteral(timeZoneNameString(m_timeZoneName)))); return options; }
String dateHourString(){return dateString() + " " + hourString();}