I'm having a hard time trying to get a datetime value from my gridview to string in the correct format that I have set to display on the gridview.
I want: yyyy/MM/dd HH:ss ex. 2020/01/30 14:15
But the result keeps giving me 1/23/2020 2:05:08 PM
Then to string with all the non-alphanumeric removed it gives me: 1232020258PM (noticed it removed any 0s in front of the mins and secs...
I have already formatted the datetime on the gridview to display the correct format. But the value to string still gives me the other format.
I've also tried to grab the data from Sql database instead of gridview, however I still get the same result.
Ultimately, I need the correct format in the string so that I can eventually take it apart again to put in a different table. And why it will be in string is because i need to grab this info to include in the name of the PDF file. Then I'll make a table using info from the name breakdown to pull the PDF to put info a table to select it.
Help? Thank you!!!
sender, GridViewCellEventArgs e)
plantCode = radGridView1.CurrentRow.Cells[
machine = radGridView1.CurrentRow.Cells[
ordNum = radGridView1.CurrentRow.Cells[
ordItem = radGridView1.CurrentRow.Cells[
apprStatus = radGridView1.CurrentRow.Cells[
custName = radGridView1.CurrentRow.Cells[
process = radGridView1.CurrentRow.Cells[
prodCode = radGridView1.CurrentRow.Cells[
custId = radGridView1.CurrentRow.Cells[
approvalTime = Regex.Replace(radGridView1.CurrentRow.Cells[
See I already formatted it on the datetime column in the gridview and this works fine displaying in the gridview: