Hello guys i have a input dialog box to select Month
tI want to get the starting and ending Date for the selected month.
Hello guys i have a input dialog box to select Month
tI want to get the starting and ending Date for the selected month.
for first day just add 1 and the year as you need
once you get that the first date use cdate(date).Addmonths(1).AddDays(-1).ToString("MM/dd/yyyy")
cheers
Try this way
First convert → MMMM to MM
var string monthNumber = DateTime.ParseExact(monthName, "MMMM", System.Globalization.CultureInfo.InvariantCulture).ToString("MM")
var datetime startDate = New DateTime(selectedYear, selectedMonth, 1)
var datetime endDate = startDate.AddMonths(1).AddDays(-1)
Here selectedYear, and selectedMonth variable type is integer
Regards,
Gowtham K
Bro this file showing invalid
Main.xaml (16.4 KB)
Could you please try this
Again the same brother
HI,
Can you share what version of Studio you use?
Also, share information about which year we should use?
Regards,
Studio version is 22.4.3
Here i have declared (monthNumber) variable.
In ( startDate) variable What is this selectedYear and selectedMonth variable
I’m not sure why you’re unable to access it, but I’ll provide the detailed steps I used in my code below. Please follow these steps in your XAML:
Assign str monthname = “September”
Assign int MonthNumber = CInt(DateTime.ParseExact(monthName, “MMMM”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”))
Assign String
FirstDay = New DateTime(Now.Year,MonthNumber,1).Tostring(“MM/dd/yyyy”)
Assign int DayinMonth = datetime.DaysInMonth(now.Year,MonthNumber)
Assign String LastDay = New Date(now.Year, MonthNumber, daysInMonth).Tostring(“MM/dd/yyyy”)
Output FirstDay and LastDay
@ Thank You guys
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.