Visual studio 2010 如何在VisualStudio2010中的rdlc报告中显示波斯日期?
我的应用程序中有一个Visual studio 2010 如何在VisualStudio2010中的rdlc报告中显示波斯日期?,visual-studio-2010,date,rdlc,persian,persian-calendar,Visual Studio 2010,Date,Rdlc,Persian,Persian Calendar,我的应用程序中有一个rdlc报告,我想用一个表达式来显示波斯日期,但问题是我找不到任何表达式,有没有办法在rdlc文件中的报告中显示波斯日期 在rdlc报告的报告菜单中,选择报告属性,然后转到“代码”选项卡,开始编写一个自定义方法,用于在VB中将格鲁吉亚日期转换为波斯语(Jalali)日历。(请记住,在自定义代码中,您只能在VB中编写代码!)然后在报表中添加一个文本框,并编写如下表达式:=code.GetPersianDate(Fields!Date.Value) 哪个日期是数据集中的一列,显然
rdlc
报告,我想用一个表达式来显示波斯日期,但问题是我找不到任何表达式,有没有办法在rdlc
文件中的报告中显示波斯日期 在rdlc报告的报告菜单中,选择报告属性,然后转到“代码”选项卡,开始编写一个自定义方法,用于在VB中将格鲁吉亚日期转换为波斯语(Jalali)日历。(请记住,在自定义代码中,您只能在VB中编写代码!)然后在报表中添加一个文本框,并编写如下表达式:=code.GetPersianDate(Fields!Date.Value)
哪个日期是数据集中的一列,显然GetPersianDate是方法的名称
感谢这真的很有帮助。在rdlc报告的报告菜单中选择报告属性,然后转到“代码”选项卡,并开始编写一个自定义方法,用于在VB中将格鲁吉亚日期转换为波斯语(Jalali)日历。(请记住,在自定义代码中,您只能在VB中编写代码!)然后在报表中添加一个文本框,并编写如下表达式:=code.GetPersianDate(Fields!Date.Value) 哪个日期是数据集中的一列,显然GetPersianDate是方法的名称 感谢
这真的很有帮助。在报告属性/代码选项卡中复制此代码
Public Function GetPersianDate(dtGeorgian as DateTime) as string
dim strPersianDate as string
dim strYear as string
dim strMonth as string
dim strDay as string
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal = new System.Globalization.PersianCalendar()
if(dtGeorgian =Nothing) then
return string.empty
end if
strYear = objPersiancal.GetYear(dtGeorgian).ToString()
strMonth = objPersiancal.GetMonth(dtGeorgian).ToString()
strDay = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
if (strDay.Length < 2) then strDay = "0" + strDay
if (strMonth.Length < 2) then strMonth = "0" + strMonth
strPersianDate = strYear + "/" + strMonth + "/" + strDay
return strPersianDate
End Function
公共函数GetPersianDate(DTA作为DateTime)作为字符串
作为字符串的dim strPersianDate
像细绳一样暗淡的头发
作为字符串的dim strMonth
作为字符串的dim strDay
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal=newsystem.Globalization.PersianCalendar()
如果(dtg=无),则
返回字符串.empty
如果结束
strYear=objPersiancal.GetYear(dtg).ToString()
strMonth=objPersiancal.GetMonth(dtg.ToString())
strDay=objPersiancal.GetDayOfMonth(dtg.ToString)()
如果(strDay.Length<2),则strDay=“0”+strDay
如果(strMonth.Length<2),则strMonth=“0”+strMonth
strPersianDate=strYear+“/”+strMonth+“/”+strDay
返回标准文本
端函数
现在,在您想要的任何文本框上单击鼠标右键并选择“表达式”,然后将此代码添加到该表达式前面。
=code.GetPersianDate()
注意:前面的表达式应该在括号内。在“报告属性/代码”选项卡中复制此代码
Public Function GetPersianDate(dtGeorgian as DateTime) as string
dim strPersianDate as string
dim strYear as string
dim strMonth as string
dim strDay as string
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal = new System.Globalization.PersianCalendar()
if(dtGeorgian =Nothing) then
return string.empty
end if
strYear = objPersiancal.GetYear(dtGeorgian).ToString()
strMonth = objPersiancal.GetMonth(dtGeorgian).ToString()
strDay = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
if (strDay.Length < 2) then strDay = "0" + strDay
if (strMonth.Length < 2) then strMonth = "0" + strMonth
strPersianDate = strYear + "/" + strMonth + "/" + strDay
return strPersianDate
End Function
公共函数GetPersianDate(DTA作为DateTime)作为字符串
作为字符串的dim strPersianDate
像细绳一样暗淡的头发
作为字符串的dim strMonth
作为字符串的dim strDay
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal=newsystem.Globalization.PersianCalendar()
如果(dtg=无),则
返回字符串.empty
如果结束
strYear=objPersiancal.GetYear(dtg).ToString()
strMonth=objPersiancal.GetMonth(dtg.ToString())
strDay=objPersiancal.GetDayOfMonth(dtg.ToString)()
如果(strDay.Length<2),则strDay=“0”+strDay
如果(strMonth.Length<2),则strMonth=“0”+strMonth
strPersianDate=strYear+“/”+strMonth+“/”+strDay
返回标准文本
端函数
现在,在您想要的任何文本框上单击鼠标右键并选择“表达式”,然后将此代码添加到该表达式前面。
=code.GetPersianDate()
注意:前面的表达式应该在括号内。表示小时、分钟和秒 您可以在前面的答案中添加一些行
Public Function GetPersianDateAndTime(dtGeorgian as DateTime) as string
dim strPersianDate as string
dim strPersianTime as string
dim strYear as string
dim strMonth as string
dim strDay as string
dim strHour as string
dim strMinute as string
dim strSeconds as string
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal = new System.Globalization.PersianCalendar()
if(dtGeorgian =Nothing) then
return string.empty
end if
strYear = objPersiancal.GetYear(dtGeorgian).ToString()
strMonth = objPersiancal.GetMonth(dtGeorgian).ToString()
strDay = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
strHour = objPersiancal.GetHour(dtGeorgian).ToString()
strMinute = objPersiancal.GetMinute(dtGeorgian).ToString()
strSeconds = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
if (strDay.Length< 2) then strDay = "0" + strDay
if (strMonth.Length< 2) then strMonth = "0" + strMonth
strPersianDate = strYear + "/" + strMonth + "/" + strDay
strPersianTime = strHour + ":" + strMinute + ":" + strSeconds
return strPersianDate+"_"+strPersianTime
End Function
公共函数GetPersianDateAndTime(DTA作为DateTime)作为字符串
作为字符串的dim strPersianDate
dim strPersianTime作为字符串
像细绳一样暗淡的头发
作为字符串的dim strMonth
作为字符串的dim strDay
暗弦
作为字符串的dim strMinute
作为字符串的dim strSeconds
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal=newsystem.Globalization.PersianCalendar()
如果(dtg=无),则
返回字符串.empty
如果结束
strYear=objPersiancal.GetYear(dtg).ToString()
strMonth=objPersiancal.GetMonth(dtg.ToString())
strDay=objPersiancal.GetDayOfMonth(dtg.ToString)()
strHour=objPersiancal.GetHour(dtg).ToString()
strMinute=objPersiancal.GetMinute(dtg).ToString()
strSeconds=objPersiancal.GetDayOfMonth(dtg.ToString)()
如果(标准日长度<2),则标准日=“0”+标准日
如果(strMonth.长度<2),则strMonth=“0”+strMonth
strPersianDate=strYear+“/”+strMonth+“/”+strDay
strPersianTime=strHour+“:”+strMinute+“:”+strSeconds
返回strPersianDate+“”+strPersianTime
端函数
小时、分钟和秒
您可以在前面的答案中添加一些行
Public Function GetPersianDateAndTime(dtGeorgian as DateTime) as string
dim strPersianDate as string
dim strPersianTime as string
dim strYear as string
dim strMonth as string
dim strDay as string
dim strHour as string
dim strMinute as string
dim strSeconds as string
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal = new System.Globalization.PersianCalendar()
if(dtGeorgian =Nothing) then
return string.empty
end if
strYear = objPersiancal.GetYear(dtGeorgian).ToString()
strMonth = objPersiancal.GetMonth(dtGeorgian).ToString()
strDay = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
strHour = objPersiancal.GetHour(dtGeorgian).ToString()
strMinute = objPersiancal.GetMinute(dtGeorgian).ToString()
strSeconds = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
if (strDay.Length< 2) then strDay = "0" + strDay
if (strMonth.Length< 2) then strMonth = "0" + strMonth
strPersianDate = strYear + "/" + strMonth + "/" + strDay
strPersianTime = strHour + ":" + strMinute + ":" + strSeconds
return strPersianDate+"_"+strPersianTime
End Function
公共函数GetPersianDateAndTime(DTA作为DateTime)作为字符串
作为字符串的dim strPersianDate
dim strPersianTime作为字符串
像细绳一样暗淡的头发
作为字符串的dim strMonth
作为字符串的dim strDay
暗弦
作为字符串的dim strMinute
作为字符串的dim strSeconds
dim objPersiancal as System.Globalization.PersianCalendar
objPersiancal=newsystem.Globalization.PersianCalendar()
如果(dtg=无),则
返回字符串.empty
如果结束
strYear=objPersiancal.GetYear(dtg).ToString()
strMonth=objPersiancal.GetMonth(dtg.ToString())
strDay=objPersiancal.GetDayOfMonth(dtg.ToString)()
strHour=objPersiancal.GetHour(dtg).ToString()
strMinute=objPersiancal.GetMinute(dtg).ToString()
strSeconds=objPersiancal.GetDayOfMonth(dtg.ToString)()
如果(标准日长度<2),则标准日=“0”+标准日
如果(strMonth.长度<2),则strMonth=“0”+strMonth
strPersianDate=strYear+“/”+strMonth+“/”+strDay
strPersianTime=strHour+“:”+strMinute+“:”+strSeconds
返回strPersianDate+“”+strPersianTime
端函数
可能相关:非常感谢