C#
lblWeek.Text = (((((int)DateTime.Today.DayOfWeek )- 1) * 24) - decimal.Parse(DateTime.Now.ToString("HH")) - 1 / 168 * 100).ToString();lblWeek.Text = (((((int)DateTime.Today.DayOfWeek )- 1) * 24) - decimal.Parse(DateTime.Now.ToString("HH")) - 1 / 168 * 100).ToString();Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Deepak TewatiaRank #142 · 16K reputationPosted Dec 17, 2022, 10:57 PM EST
Hi shoaib,
please try the below code.
lblWeek.Text = $"Week {DateTime.Now:W}, {DateTime.Now:hh}:{DateTime.Now:mm}:{DateTime.Now:ss}";If you want to display the time in a week-wise format, you can use the following code:
DateTime currentDate = DateTime.Now; int currentWeek = CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(currentDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); lblWeek.Text = "Week " + currentWeek + ": " + currentDate.ToString("hh:mm tt");This will display the current week number and the current time in the label, with "Week" as the prefix. For example, if the current week is the 50 of the year and the current time is 09:36 AM, the label will display "Week 50: 09:36 AM".
Guest UserRank #1,881 · 787 reputationPosted Dec 19, 2022, 8:12 AM EST
lbltoday.Text = (decimal.Parse(DateTime.Now.ToString("HH")) - 1 / 24 * 100).ToString(); lblMonth.Text = (((((int)DateTime.Now.Day) - 1) * 24) - decimal.Parse(DateTime.Now.ToString("HH")) - 1 / 744 * 100).ToString(); lblWeek.Text = (((((int)DateTime.Now.DayOfWeek) + 1) * 24) - decimal.Parse(DateTime.Now.ToString("HH")) - 1 / 168 * 100).ToString();i will try month 744 hours
with progress bar
I will upload Image