Esempio n. 1
0
        public static EcmaValue DatePrototypeToLocaleTimeString([This] EcmaValue thisValue, EcmaValue locales, EcmaValue options)
        {
            EcmaTimestamp dt = thisValue.GetUnderlyingObject <EcmaDate>().Timestamp;

            if (!dt.IsValid)
            {
                return("Invalid Date");
            }
            DateTimeFormat       formatter        = new DateTimeFormat();
            ICollection <string> requestedLocales = IntlUtility.CanonicalizeLocaleList(locales);

            formatter.Init(requestedLocales, DateTimeFormatConstructor.CreateOptions(options, false, true, false, false));
            return(formatter.Format(thisValue).ToString());
        }
Esempio n. 2
0
 public string ToString(string format, IFormatProvider provider)
 {
     return(DateTimeFormat.Format(this, format, DateTimeFormatInfo.GetInstance(provider)));
 }
Esempio n. 3
0
 public string ToString(string format)
 {
     return(DateTimeFormat.Format(this, format, DateTimeFormatInfo.CurrentInfo));
 }
Esempio n. 4
0
 public override string ToString()
 {
     return(DateTimeFormat.Format(this, null, DateTimeFormatInfo.CurrentInfo));
 }
Esempio n. 5
0
 public string ToShortTimeString()
 {
     return(DateTimeFormat.Format(this, "t", DateTimeFormatInfo.CurrentInfo));
 }
Esempio n. 6
0
 public string ToLongTimeString()
 {
     return(DateTimeFormat.Format(this, "T", DateTimeFormatInfo.CurrentInfo));
 }
Esempio n. 7
0
        public static EcmaValue FormatToParts([This] EcmaValue thisValue, EcmaValue date)
        {
            DateTimeFormat formatter = thisValue.GetUnderlyingObject <DateTimeFormat>();

            return(formatter.Format(date).ToPartArray());
        }