如果在datetimepicker的同一个月显示消息 [英] How to display message if same month of datetimepicker
问题描述
大家好,
如果datetimepicker中的月份与当月相同,我需要显示一条消息。
I need to display a message if the month in datetimepicker is the same as the current month.
到目前为止,我有一条基于整个日期的消息,但我需要仅在月内显示消息
尽管有一天或一年。
So far I have a message based on the entire date but I need to display the message based only in month despite the day or year.
到目前为止我的c#代码:
My c# code so far:
今天的DateTime = DateTime。 Today.Date;
if(dtpFim.Value< today)
{
MessageBox.Show(" This month message!");
$
}
否则为
{
}
DateTime today = DateTime.Today.Date;
if (dtpFim.Value < today)
{
MessageBox.Show("This month message!");
}
else
{
}
提前致谢。
推荐答案
May This帮助你
May This Help You
如果dtpFim是DateTimePicker
If dtpFim is DateTimePicker
DateTime today = DateTime.Today.Date;
if (dtpFim.Value.Month == today.Month)
{
MessageBox.Show("This month message!");
}
else
{
}
这篇关于如果在datetimepicker的同一个月显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!