|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Locale timeI have a windows application, where i want to save the date and time of the
transaction in the database, after converting it to the datetime of the locale of the server. When the same transaction is displayed back to the client, i want to convert it back to the datetime of the locale of the client PC, and display it . How can this be done ? The Date type has ToUniversalTime() and ToLocalTime() methods:
Dim dtUTC As Date Dim dtLocalTime As Date Dim dtLocalTimeAgain As Date dtLocalTime = System.DateTime.Now() dtUTC = dtLocalTime.ToUniversalTime() dtLocalTimeAgain = dtUTC.ToLocalTime() A note: you should get the transaction date on the server side (in Oracle you execute "SELECT SYSDATE FROM DUAL"), convert it to UTC and return it back to the client, which in turn converts it into local time. Otherwise, if you get the transaction date on the client side and pass it to the server, the client Windows machine could have the clock wrong. Show quote "Chakra" <r_chakravar***@hotmail.com> escribió en el mensaje news:%23eP9Obf0EHA.1524@TK2MSFTNGP09.phx.gbl... >I have a windows application, where i want to save the date and time of the > transaction in the database, after converting it to the datetime of the > locale of the server. When the same transaction is displayed back to the > client, i want to convert it back to the datetime of the locale of the > client PC, and display it . > > How can this be done ? > > |
|||||||||||||||||||||||