Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tricky DateTime Question

Status
Not open for further replies.

toptomato

Programmer
Jul 22, 2005
62
0
0
US
I have a webservice that returns a dataset that contains a datetime field. The server hosting the webservice is in EST Time zone. The consumer application is on a Server in PST Time zone. When the consumer application gets the dataset returned by the webservice, it then binds that dataset to a datagrid. Now one of datagrid's column is bound to the datetime field of the dataset. The problem is that the time is being displayed in the PST Time instead of the EST Time.
Is there a quick fix for that other than making the page culture specific. I am thinking may be some thing like specifiying time zone in the Data Formatting Expression property of the datagrid's column's bound to the datetime field.
 
Can't you simply use AddHours to change the time to the relevant time zone?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Why would the time change according to time zone? If the data is inserted, it will use the time on the server that the DB is on. Just doing a select and returning data should change nothing. Only inserts and updates would be affected.

Jim
 
well the data is extracted from db by the WebService when then serialized it in xml and send it over to a different time zone. The problem occured over the xml transport. Hi, ca8msm, you are right that is a possible option, however the datagrid's column is bound directly to the column in dataset. Can you see an alternative to you above solution. Or possible can send some code samples
thanks
 
I would find out why data is being changed. This should not happen, even if it is getting serialized. Data is data and should not change in that way.
 
Jim's right. If the data doesn't start in the incorrect format, then it shouldn't end up in it (after all, it should be irrelevant that it's actually a date) so you should find out why it is being changed.

As a workaround, you could use the ItemDataBound event of the DataGrid to change the date back.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
well, data isn't being changed but represented in a different (from EST to PST) format.
 
yep that is it. Is there way to force it to display the EST time. since there is a disclaimer on the page which says: "All Times are EST". The easiest solution would be to take out the disclaimer, but unfortunatly we can't take out the disclaimer so we have to force the time in EST format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top