コード例 #1
0
        public static string ReturnFormattedDateForCalendarFutureDates(string givenDate)
        {
            //string _TimeValue = GetCurrentClaimValues.GetCurrentUserTimezone();
            //Thread.CurrentThread.CurrentCulture = new CultureInfo(GetCurrentClaimValues.GetCurrentUserCultureInfo());
            //DateTime _givenDate;
            //DateTime.TryParse(givenDate, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out _givenDate);
            //TimeZoneInfo _TimeZone = TimeZoneInfo.FindSystemTimeZoneById(_TimeValue);
            //string convertedDateTime = TimeZoneInfo.ConvertTime(_givenDate, _TimeZone).
            //    ToString(ReturnUserDateFormat(mobile));
            string _givenDate = DateTime.Parse(givenDate).ToString(GetCurrentClaimValues.GetCurrentUserDateFormat());

            //string[] splitConvertedDateTime = givenDate.Split(' ');
            //string convertedDate = splitConvertedDateTime[0];


            return(_givenDate);
        }
コード例 #2
0
        public static string ReturnUserDateFormat(bool mobile, string hotelName = "")
        {
            string dateFormat = string.Empty;

            if (mobile == false)
            {
                dateFormat = GetCurrentClaimValues.GetCurrentUserDateFormat();
            }
            else
            {
                string connectionString = CommonManager.ReturnNeededConnectionStringForHotelWithNameSent(hotelName);

                string sqlGetDateFormat = "SELECT dateFormat FROM tblCommonData";
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    SqlCommand cmdToGetDateFormat = new SqlCommand(sqlGetDateFormat, conn);
                    dateFormat = cmdToGetDateFormat.ExecuteScalar().ToString();
                }
            }
            return(dateFormat);
        }