Date format changed when printing report in c# -


i developed application uses reports, , have problem when attemp print report date format changed format on client pc, although print date in correct format on pc, here 2 pictures first pc , other client pc

my pc

enter image description here

client pc enter image description here

here code used display report

string datestring = datetimepicker1.value.tostring("yyyy/mm/dd");         datetime dt = datetime.parseexact(datestring, "yyyy/mm/dd", null);         string datestring2 = datetimepicker2.value.tostring("yyyy/mm/dd");         datetime dt2 = datetime.parseexact(datestring2, "yyyy/mm/dd", null);          dailyworktableadapter.fill(this.workingmgmtdataset1.dailywork,label2.text,dt,dt2);         datatable1tableadapter.fill(this.finalds.datatable1,dt,dt2,label2.text);          this.reportviewer1.refreshreport(); 

the date field expresion in report :

=fields!date.value 

the client pc seems setup different culture. can force format of datetime value this:

datetime dt = datetime.now; string s = dt.tostring("mm/dd/yyyy hh:mm:ss"); 

you can review culture namespace more info on dealing sort of thing: https://msdn.microsoft.com/en-us/library/5hh873ya(v=vs.90).aspx


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -