1st pic is from where I have hosted the web application and the second one is on client machine.
I am doing the same operation in server as well in client machine, but getting different out put. how it can be possible.
see the Date column in gridview,( they are different in both gridviews).
Hosted on server
ON client machine
It is our choices that show what we truly are, far more than our abilities...
you havent posted the code which populated the gridivew... or rodatabound event of gridview...
so, it difficult to guess... but, i think this is because u r hosted server and client machine has different culture setting which configures time format used... on server it is 12hour format while on client machine its 24hr format
check how u can change/check the time format on both server
demoninside9
Participant
1204 Points
1708 Posts
how it can be possible ? date doesn't maches
Jan 29, 2013 04:07 AM|LINK
hi all,
here i am posting two pictures.
1st pic is from where I have hosted the web application and the second one is on client machine.
I am doing the same operation in server as well in client machine, but getting different out put. how it can be possible. see the Date column in gridview,( they are different in both gridviews).
Hosted on server
ON client machine
kedarrkulkar...
All-Star
34421 Points
5534 Posts
Re: how it can be possible ? date doesn't maches
Jan 29, 2013 04:36 AM|LINK
you havent posted the code which populated the gridivew... or rodatabound event of gridview...
so, it difficult to guess... but, i think this is because u r hosted server and client machine has different culture setting which configures time format used... on server it is 12hour format while on client machine its 24hr format
check how u can change/check the time format on both server
http://answers.microsoft.com/en-us/windows/forum/windows_vista-desktop/control-panel-change-12-hour-clock-to-24-hour/490a874b-7d3a-4fa4-ad38-c6ebc24a854a
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
demoninside9
Participant
1204 Points
1708 Posts
Re: how it can be possible ? date doesn't maches
Jan 29, 2013 04:43 AM|LINK
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((string)DataBinder.Eval(e.Row.DataItem, "Attendance_Status") == "A") { e.Row.BackColor = System.Drawing.Color.Gray; e.Row.ForeColor = System.Drawing.Color.Black; e.Row.Cells[6].Text = "On Leave"; } string tm = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Out_Time")); string tm1 = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "In_Time")); if ((tm1 == "") || (tm1 == null)) { } else { DateTime str = Convert.ToDateTime(tm1); string res = str.ToString("t"); if (res == "12:00 AM") { e.Row.Cells[3].Text = "Not logged In"; e.Row.Cells[5].Text = "NA"; } } if ((tm == "") || (tm == null)) { } else { DateTime str = Convert.ToDateTime(tm); string res = str.ToString("t"); if (res == "12:00 AM") { e.Row.Cells[4].Text = "Not logged out"; e.Row.Cells[5].Text = "NA"; } } } }kedarrkulkar...
All-Star
34421 Points
5534 Posts
Re: how it can be possible ? date doesn't maches
Jan 29, 2013 08:15 AM|LINK
since I could not find any formating related code in databound event, I assume formatting has been used in gridview tag
try this... go to gridview tag in aspx page... and locate the time column <asp:BoundField ..> , see if it has attribute named DateFormatString
if yes, change its value to <asp:BoundFieldColumn id="zzz" HeaderText="In" runat="server" DateFormatString="{0:h:mm tt}" ... />
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
demoninside9
Participant
1204 Points
1708 Posts
Re: how it can be possible ? date doesn't maches
Jan 29, 2013 09:34 AM|LINK
that's ok. but could you please tell me what is the issue with the following. currently I have done this
<ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Convert.ToDateTime(Eval("Login_Date")).ToString("dd/MM/yyyy") %>'></asp:Label> </ItemTemplate>Thanks
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: how it can be possible ? date doesn't maches
Jan 30, 2013 11:57 PM|LINK
Hi,
Problem is the Formation of your defination. Please change to "h:mm tt", otherwises it will be the local datetime formation.