System.Globalization.DateTimeFormatInfo.GetAbbreviatedDayName C# (CSharp) Méthode

GetAbbreviatedDayName() public méthode

Returns the culture-specific abbreviated name of the specified day of the week based on the culture associated with the current DateTimeFormatInfo object.
public GetAbbreviatedDayName ( DayOfWeek dayofweek ) : string
dayofweek DayOfWeek A System.DayOfWeek value.
Résultat string
        public extern string GetAbbreviatedDayName(DayOfWeek dayofweek);

Usage Example

		public async Task<Forecast> GetForecastAsync (Position location)
		{
			var openWeatherForecast = await _openWeatherMapService.Get7DayForecastAsync (location);
			var forecast = new Forecast () {
				Location = location
			};

			var daysClean = 0;
			var dtf = new DateTimeFormatInfo ();
			
			foreach (var forecastItem in openWeatherForecast.Forecasts) {
				var weather = forecastItem.WeatherList.FirstOrDefault ();
				var date = new DateTime (1970, 1, 1).AddSeconds (forecastItem.Dt);
			
				forecast.WeatherList.Add (new WeatherViewTemplate {
					WeatherCondition = weather.Description,
					DayAbbreviation = dtf.GetAbbreviatedDayName (date.DayOfWeek),
					TempHigh = Convert.ToInt32(forecastItem.Temperature.Max) + "º",
					TempLow = Convert.ToInt32(forecastItem.Temperature.Min) + "º",
					Icon = GetWeatherIcon (weather.Main)
				});
			
			}

			foreach (var forecastItem in openWeatherForecast.Forecasts) {
				var date = new DateTime (1970, 1, 1).AddSeconds (forecastItem.Dt);
			
				if (date.Date.Date < DateTime.Now.Date.Date)
					continue;
			
				var weatherForToday = forecastItem.WeatherList [0];
			
				forecast.BadWeatherDay = date;
				forecast.Reason = ConvertReason (weatherForToday.Main);
				forecast.ReasonDescription = weatherForToday.Description;
			
				if (WeatherIsBad (weatherForToday))
					break;
			
				daysClean++;
			}
			
			forecast.DaysClean = daysClean;

			return forecast;
		}
All Usage Examples Of System.Globalization.DateTimeFormatInfo::GetAbbreviatedDayName