Beispiel #1
0
        public void CheckCorrect(
            ScheduleSpec spec,
            string now,
            string expected)
        {
            var nowDate      = timeFormat.Parse(now);
            var expectedDate = timeFormat.Parse(expected);

            var result = ScheduleComputeHelper.ComputeNextOccurance(
                spec, nowDate.UtcMillis, TimeZoneInfo.Utc, TimeAbacusMilliseconds.INSTANCE);
            var resultDate = DateTimeEx.GetInstance(TimeZoneInfo.Utc, result);

            if (!resultDate.Equals(expectedDate))
            {
                Log.Debug(".checkCorrect Difference in result found, spec=" + spec);
                Log.Debug(
                    ".checkCorrect      now=" + timeFormat.Format(nowDate) +
                    " long=" + nowDate.UtcMillis);
                Log.Debug(
                    ".checkCorrect expected=" + timeFormat.Format(expectedDate) +
                    " long=" + expectedDate.UtcMillis);
                Log.Debug(
                    ".checkCorrect   result=" + timeFormat.Format(resultDate) +
                    " long=" + resultDate.UtcMillis);
                Assert.IsTrue(false);
            }
        }
Beispiel #2
0
        public void ExcelDateBorderCases()
        {
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

            Assert.AreEqual(1.0, DateUtil.GetExcelDate(df.Parse("1900-01-01")), 0.00001);
            Assert.AreEqual(31.0, DateUtil.GetExcelDate(df.Parse("1900-01-31")), 0.00001);
            Assert.AreEqual(32.0, DateUtil.GetExcelDate(df.Parse("1900-02-01")), 0.00001);
            Assert.AreEqual(/* BAD_DATE! */ -1.0, DateUtil.GetExcelDate(df.Parse("1899-12-31")), 0.00001);
        }
        public void LoadDataDateWise()
        {
            SimpleDateFormat myFormat = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat fromUser = new SimpleDateFormat("dd-MM-yyyy");

            d1 = txtSurvatichiTarikh.Text;
            d2 = txtShewatchiTarikh.Text;


            d1 = d1.Replace("/", "-");
            d2 = d2.Replace("/", "-");
            String[] data = d2.Split('-');
            d2 = Convert.ToString(Convert.ToInt32(data[0]) + 1) + "-" + data[1]
                 + "-" + data[2];
            String tstart = "", tend = "";

            try
            {
                btnNave.RequestFocus();
                total = 0.00;
                var db = new SQLiteConnection(dbPath);

                tstart = myFormat.Format(fromUser.Parse(d1));
                tend   = myFormat.Format(fromUser.Parse(d2));


                var data1 = db.Query <KhatawaniTapshilNaveJama>("SELECT     CM.khatawani_No, GM.GirviRecordNo, GIM.metal_type, GIM.item_type, GIM.Total_Quantity, GIM.gross_wt, GIM.net_wt, GIM.fine_wt, GM.Amount, GM.Date_of_deposit, CM.FullName, CM.Contact_No, CM.Address,GM.Status,datetime(substr(Date_of_deposit, 7, 4) || '-' || substr(Date_of_deposit, 4, 2) || '-' || substr(Date_of_deposit, 1, 2)) AS SomeDate FROM customer_master AS CM INNER JOIN GirviMaster AS GM ON CM.khatawani_No = GM.khatawani_No INNER JOIN GirviItemMaster AS GIM ON GM.GirviRecordNo = GIM.GirviNo where GM.Status = '" + StatusAssign + "' and SomeDate >= DATE('"
                                                                + tstart
                                                                + "') AND SomeDate <= DATE('"
                                                                + tend
                                                                + "') order by SomeDate desc ").ToList();


                Result = data1;

                mListView.Adapter = new RokadAdapter(this, Result);
                for (int i = 0; i < mListView.Count; i++)
                {
                    STotal = Result[i].Amount.ToString();
                    total  = total + Convert.ToDouble(STotal);
                }
            }
            catch { }

            if (StatusAssign == "unchange")
            {
                btnTotal.Text = "0.0";
                btnTotal.Text = Convert.ToString(" नावे : " + total);
            }
            else if (StatusAssign == "Release")
            {
                btnTotal.Text = "0.0";
                btnTotal.Text = Convert.ToString(" जमा : " + total);
            }
        }
Beispiel #4
0
        public virtual void WeeksAgo()
        {
            string           dateStr = "2007-02-21 15:35:00 +0100";
            SimpleDateFormat df      = SystemReader.GetInstance().GetSimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"
                                                                                      );
            DateTime          refDate = df.Parse(dateStr);
            GregorianCalendar cal     = new GregorianCalendar(SystemReader.GetInstance().GetTimeZone
                                                                  (), SystemReader.GetInstance().GetLocale());

            cal.SetTime(refDate);
            DateTime parse = GitDateParser.Parse("2 weeks ago", cal);

            NUnit.Framework.Assert.AreEqual(df.Parse("2007-02-07 15:35:00 +0100"), parse);
        }
        public static Date GetExifDateTime(string filepath)
        {
            ExifInterface exif;

            try
            {
                exif = NewInstance(filepath);
            }
            catch //(IOException var5)
            {
                return(null);
            }

            string date = exif.GetAttribute("DateTime");

            if (TextUtils.IsEmpty(date))
            {
                return(null);
            }
            else
            {
                try
                {
                    var e = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss")
                    {
                        TimeZone = TimeZone.GetTimeZone("UTC")
                    };
                    return(e.Parse(date));
                }
                catch// (ParseException var4)
                {
                    return(null);
                }
            }
        }
Beispiel #6
0
        /// <summary>Parses the date value using the given date formats.</summary>
        /// <remarks>Parses the date value using the given date formats.</remarks>
        /// <param name="dateValue">the date value to parse</param>
        /// <param name="dateFormats">the date formats to use</param>
        /// <param name="startDate">
        /// During parsing, two digit years will be placed in the range
        /// <code>startDate</code> to <code>startDate + 100 years</code>. This value may
        /// be <code>null</code>. When <code>null</code> is given as a parameter, year
        /// <code>2000</code> will be used.
        /// </param>
        /// <returns>the parsed date or null if input could not be parsed</returns>
        public static DateTime ParseDate(string dateValue, string[] dateFormats, DateTime
                                         startDate)
        {
            Args.NotNull(dateValue, "Date value");
            string[] localDateFormats = dateFormats != null ? dateFormats : DefaultPatterns;
            DateTime localStartDate   = startDate != null ? startDate : DefaultTwoDigitYearStart;
            string   v = dateValue;

            // trim single quotes around date if present
            // see issue #5279
            if (v.Length > 1 && v.StartsWith("'") && v.EndsWith("'"))
            {
                v = Sharpen.Runtime.Substring(v, 1, v.Length - 1);
            }
            foreach (string dateFormat in localDateFormats)
            {
                SimpleDateFormat dateParser = DateUtils.DateFormatHolder.FormatFor(dateFormat);
                dateParser.Set2DigitYearStart(localStartDate);
                ParsePosition pos    = new ParsePosition(0);
                DateTime      result = dateParser.Parse(v, pos);
                if (pos.GetIndex() != 0)
                {
                    return(result);
                }
            }
            return(null);
        }
        private void CompareProperties(OPCPackage p)
        {
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

            df.TimeZone = TimeZoneInfo.Utc;
            DateTime expectedDate = df.Parse("2007-05-12T08:00:00Z");

            // Gets the core properties
            PackageProperties props = p.GetPackageProperties();

            Assert.AreEqual("MyCategory", props.GetCategoryProperty());
            Assert.AreEqual("MyContentStatus", props.GetContentStatusProperty()
                            );
            Assert.AreEqual("MyContentType", props.GetContentTypeProperty());
            Assert.AreEqual(expectedDate, props.GetCreatedProperty());
            Assert.AreEqual("MyCreator", props.GetCreatorProperty());
            Assert.AreEqual("MyDescription", props.GetDescriptionProperty());
            Assert.AreEqual("MyIdentifier", props.GetIdentifierProperty());
            Assert.AreEqual("MyKeywords", props.GetKeywordsProperty());
            Assert.AreEqual("MyLanguage", props.GetLanguageProperty());
            Assert.AreEqual("Julien Chable", props.GetLastModifiedByProperty()
                            );
            Assert.AreEqual(expectedDate, props.GetLastPrintedProperty());
            Assert.AreEqual(expectedDate, props.GetModifiedProperty());
            Assert.AreEqual("2", props.GetRevisionProperty());
            Assert.AreEqual("MySubject", props.GetSubjectProperty());
            Assert.AreEqual("MyTitle", props.GetTitleProperty());
            Assert.AreEqual("2", props.GetVersionProperty());
        }
Beispiel #8
0
 private static long DateToLong(string dateText)
 {
     var format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.fff");
     var date = format.Parse(dateText);
     log.Debug(".dateToLong out=" + date);
     return date.UtcMillis;
 }
        // tries to parse a string with the formats supported by SimpleDateFormat
        /// <exception cref="Sharpen.ParseException"></exception>
        private static DateTime Parse_simple(string dateStr, GitDateParser.ParseableSimpleDateFormat
                                             f)
        {
            SimpleDateFormat dateFormat = GetDateFormat(f);

            dateFormat.SetLenient(false);
            return(dateFormat.Parse(dateStr));
        }
Beispiel #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static boolean isPastCutoverDate(String s) throws java.text.ParseException
        private static bool IsPastCutoverDate(String s)
        {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);

            format.TimeZone = TimeZone.GetTimeZone("UTC");
            format.Lenient  = false;
            long time = format.Parse(s.Trim()).Ticks;

            return(DateTimeHelperClass.CurrentUnixTimeMillis() > time);
        }
Beispiel #11
0
            /// <exception cref="Org.Xml.Sax.SAXException"/>
            public override void StartElement(string ns, string localname, string qname, Attributes
                                              attrs)
            {
                if ("listing".Equals(qname))
                {
                    return;
                }
                if (!"file".Equals(qname) && !"directory".Equals(qname))
                {
                    if (typeof(RemoteException).Name.Equals(qname))
                    {
                        throw new SAXException(RemoteException.ValueOf(attrs));
                    }
                    throw new SAXException("Unrecognized entry: " + qname);
                }
                long modif;
                long atime = 0;

                try
                {
                    SimpleDateFormat ldf = HftpFileSystem.df.Get();
                    modif = ldf.Parse(attrs.GetValue("modified")).GetTime();
                    string astr = attrs.GetValue("accesstime");
                    if (astr != null)
                    {
                        atime = ldf.Parse(astr).GetTime();
                    }
                }
                catch (ParseException e)
                {
                    throw new SAXException(e);
                }
                FileStatus fs = "file".Equals(qname) ? new FileStatus(long.Parse(attrs.GetValue("size"
                                                                                                )), false, short.ValueOf(attrs.GetValue("replication")), long.Parse(attrs.GetValue
                                                                                                                                                                        ("blocksize")), modif, atime, FsPermission.ValueOf(attrs.GetValue("permission"))
                                                                      , attrs.GetValue("owner"), attrs.GetValue("group"), this._enclosing.MakeQualified
                                                                          (new Path(this._enclosing.GetUri().ToString(), attrs.GetValue("path")))) : new FileStatus
                                    (0L, true, 0, 0L, modif, atime, FsPermission.ValueOf(attrs.GetValue("permission"
                                                                                                        )), attrs.GetValue("owner"), attrs.GetValue("group"), this._enclosing.MakeQualified
                                        (new Path(this._enclosing.GetUri().ToString(), attrs.GetValue("path"))));

                this.fslist.AddItem(fs);
            }
        public static Date ConvertStringToDate(string date, string dateFormat)
        {
            if (string.IsNullOrWhiteSpace(dateFormat))
            {
                dateFormat = DEFAULT_TIME_FORMAT;
            }

            var simpleDateFormat = new SimpleDateFormat(dateFormat, Locale.Default);

            return(simpleDateFormat.Parse(date));
        }
Beispiel #13
0
        /**
         * Convert a string value represented a date into a DateTime?.
         *
         * @throws InvalidFormatException
         *             Throws if the date format isnot valid.
         */
        private DateTime?SetDateValue(String dateStr)
        {
            if (dateStr == null || dateStr.Equals(""))
            {
                return(new Nullable <DateTime>());
            }
            Match  m = TIME_ZONE_PAT.Match(dateStr);
            String dateTzStr;

            if (m.Success)
            {
                dateTzStr = dateStr.Substring(0, m.Index) +
                            m.Groups[1].Value + m.Groups[2].Value;
                foreach (String fStr in TZ_DATE_FORMATS)
                {
                    SimpleDateFormat df = new SimpleDateFormat(fStr);
                    df.TimeZone = TimeZoneInfo.Utc;
                    DateTime d = df.Parse(dateTzStr);
                    if (d != null)
                    {
                        return(new DateTime?(d));
                    }
                }
            }
            dateTzStr = dateStr.EndsWith("Z") ? dateStr : (dateStr + "Z");
            foreach (String fStr in DATE_FORMATS)
            {
                SimpleDateFormat df = new SimpleDateFormat(fStr);
                df.TimeZone = TimeZoneInfo.Utc;
                DateTime d = df.Parse(dateTzStr).ToUniversalTime();
                if (d != null)
                {
                    return(new DateTime?(d));
                }
            }
            //if you're here, no pattern matched, throw exception
            StringBuilder sb = new StringBuilder();
            int           i  = 0;

            foreach (String fStr in TZ_DATE_FORMATS)
            {
                if (i++ > 0)
                {
                    sb.Append(", ");
                }
                sb.Append(fStr);
            }
            foreach (String fStr in DATE_FORMATS)
            {
                sb.Append(", ").Append(fStr);
            }
            throw new InvalidFormatException("Date " + dateStr + " not well formatted, "
                                             + "expected format in: " + sb.ToString());
        }
Beispiel #14
0
        /// <exception cref="java.text.ParseException"/>
        public static int GetDaysAgo(DateTime oldTime)
        {
            DateTime         newTime  = new DateTime();
            SimpleDateFormat format   = new SimpleDateFormat("yyyy-MM-dd");
            string           todayStr = format.Format(newTime);
            DateTime         today    = format.Parse(todayStr);
            // 86400000=24*60*60*1000 一天
            int n = (int)((today.Millisecond - oldTime.Millisecond) / 86400000);

            return(n);
        }
Beispiel #15
0
        private static Date Parse(String str, SimpleDateFormat format)
        {
            Date d;

            try {
                d = format.Parse(str);
            } catch (ParseException e) {
                log.Warn("Error parsing date '" + str + "' according to format '" + format.ToPattern() + "': " + e.Message, e);
                return(null);
            }
            return(d);
        }
Beispiel #16
0
        public static DateTime ToDateTime(string s, string[] formats)
        {
            foreach (var format in formats)
            {
                var simpleDateFormat = new SimpleDateFormat(ToJavaFormat(format), Locale.US);
                var parsePosition = new ParsePosition(0);
                var date = simpleDateFormat.Parse(s, parsePosition);
                if (date != null && parsePosition.Index != 0) return DateTime.FromDate(date);
            }

            throw new ArgumentException(s + " cannot be parsed as DateTime");
        }
Beispiel #17
0
        public void DatewiseLoadDate()
        {
            SimpleDateFormat myFormat = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat fromUser = new SimpleDateFormat("dd-MM-yyyy");

            d1 = txtSurvatichiTarikh.Text;
            d2 = txtShewatchiTarikh.Text;


            d1 = d1.Replace("/", "-");
            d2 = d2.Replace("/", "-");
            String[] data = d2.Split('-');
            d2 = Convert.ToString(Convert.ToInt32(data[0]) + 1) + "-" + data[1]
                 + "-" + data[2];
            String tstart = "", tend = "";

            try
            {
                tstart = myFormat.Format(fromUser.Parse(d1));
                tend   = myFormat.Format(fromUser.Parse(d2));



                var db = new SQLiteConnection(filename);

                var data1 = db.Query <customer_master>("SELECT  customer_master.FullName, customer_master.Address,customer_master.Contact_No,GirviMaster.receipt_no,GirviMaster.interset_rate,GirviMaster.Amount, GirviMaster.Date_of_deposit,GirviMaster.forwardstatus,datetime(substr(Date_of_deposit, 7, 4) || '-' || substr(Date_of_deposit, 4, 2) || '-' || substr(Date_of_deposit, 1, 2)) AS SomeDate ,GirviMaster.khatawani_No, GirviMaster.duration, GirviMaster.GirviRecordNo,customer_master.PageNo FROM  customer_master INNER JOIN GirviMaster ON customer_master.khatawani_No = GirviMaster.khatawani_No WHERE (status='unchange') and SomeDate >= DATE('"
                                                       + tstart
                                                       + "') AND SomeDate <= DATE('"
                                                       + tend
                                                       + "') order by SomeDate desc ").ToList();


                Result            = data1;
                mListView.Adapter = new GirviDailyReportAdapter(this, Result);
            }
            catch (ParseException e1)
            {
                e1.PrintStackTrace();
            }
        }
        public ActionResult setNightNameList()
        {
            string teacherid = Session["UserID"].ToString();
            string time      = (from b in db.vw_ClassBatch
                                where b.TeacherID == teacherid
                                select b.Datetime)
                               .First().ToString();
            SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            DateTime         date    = formart.Parse(time);

            db.sp_getNightNameList(date, teacherid);
            return(getExcel(date));
        }
Beispiel #19
0
        public static DateTime GetDateFromString(string date, string format)
        {
            SimpleDateFormat formatter = new SimpleDateFormat(format);

            try
            {
                return(new DateTime(formatter.Parse(date).Millisecond));
            }
            catch (Exception)
            {
            }
            return(DateTime.Now);
        }
        public string date_difference(DateTime current_date, DateTime second_date)
        {
            SimpleDateFormat sdf   = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            Date             date1 = sdf.Parse(current_date.ToString());
            Date             date2 = sdf.Parse(second_date.ToString());

            if (date1.After(date2))
            {
                return("Time out");
            }
            // before() will return true if and only if date1 is before date2
            else if (date1.Before(date2))
            {
                TimeSpan span      = (second_date - current_date);
                string   time_left = span.Days + "(days) " + span.Hours + "(hrs.) " + span.Minutes + "(min. )";
                return(time_left);
            }
            else
            {
                return("");
            }
        }
Beispiel #21
0
        public virtual void TestMetadata()
        {
            //Metadata without description
            DateFormat format = new SimpleDateFormat("y/m/d");
            DateTime   date   = format.Parse("2013/12/25");

            KeyProvider.Metadata meta = new KeyProvider.Metadata("myCipher", 100, null, null,
                                                                 date, 123);
            Assert.Equal("myCipher", meta.GetCipher());
            Assert.Equal(100, meta.GetBitLength());
            NUnit.Framework.Assert.IsNull(meta.GetDescription());
            Assert.Equal(date, meta.GetCreated());
            Assert.Equal(123, meta.GetVersions());
            KeyProvider.Metadata second = new KeyProvider.Metadata(meta.Serialize());
            Assert.Equal(meta.GetCipher(), second.GetCipher());
            Assert.Equal(meta.GetBitLength(), second.GetBitLength());
            NUnit.Framework.Assert.IsNull(second.GetDescription());
            Assert.True(second.GetAttributes().IsEmpty());
            Assert.Equal(meta.GetCreated(), second.GetCreated());
            Assert.Equal(meta.GetVersions(), second.GetVersions());
            int newVersion = second.AddVersion();

            Assert.Equal(123, newVersion);
            Assert.Equal(124, second.GetVersions());
            Assert.Equal(123, meta.GetVersions());
            //Metadata with description
            format = new SimpleDateFormat("y/m/d");
            date   = format.Parse("2013/12/25");
            IDictionary <string, string> attributes = new Dictionary <string, string>();

            attributes["a"] = "A";
            meta            = new KeyProvider.Metadata("myCipher", 100, "description", attributes, date,
                                                       123);
            Assert.Equal("myCipher", meta.GetCipher());
            Assert.Equal(100, meta.GetBitLength());
            Assert.Equal("description", meta.GetDescription());
            Assert.Equal(attributes, meta.GetAttributes());
            Assert.Equal(date, meta.GetCreated());
            Assert.Equal(123, meta.GetVersions());
            second = new KeyProvider.Metadata(meta.Serialize());
            Assert.Equal(meta.GetCipher(), second.GetCipher());
            Assert.Equal(meta.GetBitLength(), second.GetBitLength());
            Assert.Equal(meta.GetDescription(), second.GetDescription());
            Assert.Equal(meta.GetAttributes(), second.GetAttributes());
            Assert.Equal(meta.GetCreated(), second.GetCreated());
            Assert.Equal(meta.GetVersions(), second.GetVersions());
            newVersion = second.AddVersion();
            Assert.Equal(123, newVersion);
            Assert.Equal(124, second.GetVersions());
            Assert.Equal(123, meta.GetVersions());
        }
Beispiel #22
0
        /// <summary>
        /// Parse date from an input string. Return current time if parsed failed.
        /// </summary>
        /// <param name="dateStr">input date string</param>
        /// <returns>date from date string</returns>
        public static Date ParseDate(String dateStr)
        {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.Default);

            try
            {
                return(simpleDateFormat.Parse(dateStr));
            }
            catch (ParseException e)
            {
                e.PrintStackTrace();
            }
            return(new Date(Java.Lang.JavaSystem.CurrentTimeMillis()));
        }
Beispiel #23
0
        public static DateTime GetDateFromString(string date)
        {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

            try
            {
                return(new DateTime(formatter.Parse(date).Millisecond));
            }
            catch (ParseException)
            {
            }

            return(DateTime.Now);
        }
Beispiel #24
0
 public static long GetLongtimeOfYMD(string time)
 {
     try
     {
         SimpleDateFormat sdf  = new SimpleDateFormat("yyyy-MM-dd");
         Date             date = sdf.Parse(time);
         return(date.Time);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Beispiel #25
0
        private void initCalendar()
        {
            removeUselessData();
            List <EventDay> events = new List <EventDay>();

            foreach (KeyValuePair <string, List <HMEvent> > entry in mDict)
            {
                Calendar         calendar = Calendar.GetInstance(new Locale("en_AU"));
                SimpleDateFormat sdf      = new SimpleDateFormat("MM-dd-yyyy", new Locale("en_AU"));
                calendar.Time = sdf.Parse(entry.Key);
                EventDay eventDay = new EventDay(calendar, Resource.Mipmap.cleaning);
                events.Add(eventDay);
            }
            mCalendarView.SetEvents(events);
        }
Beispiel #26
0
        public static DateTime ToDateTime(string s, string[] formats)
        {
            foreach (var format in formats)
            {
                var simpleDateFormat = new SimpleDateFormat(ToJavaFormat(format), Locale.US);
                var parsePosition    = new ParsePosition(0);
                var date             = simpleDateFormat.Parse(s, parsePosition);
                if (date != null && parsePosition.Index != 0)
                {
                    return(DateTime.FromDate(date));
                }
            }

            throw new ArgumentException(s + " cannot be parsed as DateTime");
        }
        public ActionResult setNightNameList()
        {
            string teacherid = Session["UserID"].ToString();
            string time      = (from b in db.vw_ClassBatch
                                where b.TeacherID == teacherid
                                select b.Datetime)
                               .First().ToString();
            SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            DateTime         date    = formart.Parse(time);

            //db.sp_getNightNameList(date, teacherid);
            //此处存疑,2017.9.3日重新生成model时,此行报错,提示存储过程找不到两个参数的重载,故删去date。但再重新生成model之前时不报错的,所以可能还会有bug
            db.sp_getNightNameList(teacherid);
            return(getExcel(date));
        }
Beispiel #28
0
        /// <exception cref="java.text.ParseException"/>
        public static bool IsDaybeforeYeaterday(DateTime oldTime)
        {
            DateTime newTime = new DateTime();
            // 将下面的 理解成 yyyy-MM-dd 00:00:00 更好理解点
            SimpleDateFormat format   = new SimpleDateFormat("yyyy-MM-dd");
            string           todayStr = format.Format(newTime);
            DateTime         today    = format.Parse(todayStr);

            // 昨天 86400000=24*60*60*1000 一天
            if ((today.Millisecond - oldTime.Millisecond) > 86400000 && (today.Millisecond - oldTime.Millisecond) <= 86400000 * 2)
            {
                return(true);
            }
            return(false);
        }
Beispiel #29
0
        public static String AddingTSeprator(String date)
        {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-dd-MM HH:mm:ss");
            String d="";
            try
            {
                Date date1 = format.Parse(date.Replace(" ", "T"));
                d = new SimpleDateFormat("yyyy/dd/MMTHH:mm:ss").Format(date1);
            }
   catch (Exception e)
            {

            }
            return d;
        }
Beispiel #30
0
        public Calendar GetDate(string p_date)
        {
            var _result = Calendar.Instance;

            try
            {
                var sdFormat = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss");
                _result.Time = sdFormat.Parse(p_date);
            }
            catch (Java.Lang.Exception ex)
            {
                Log.Error(this.GetType().Name, ex.Message);
            }

            return(_result);
        }
        public static Date convertDateTimeToDate(string datetime)
        {
            string           sourceDate = datetime;
            SimpleDateFormat format     = new SimpleDateFormat("yyyy-MM-dd");
            Date             myDate     = null;

            try
            {
                myDate = format.Parse(sourceDate);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Print(e.Message);
            }
            return(myDate);
        }