Mehyar Posted September 10, 2003 Posted September 10, 2003 Hello all, I will list my problem hope you dont get bored..... I am developing a windows application that communicates with a remote sql database via a web service.... No need to mention everything, what i need is to check the time difference between the web service server and the client's application before i allow the client to connect to the webservice if there is a certain time difference i would prompt him to fix his time. The problem is that the web service is located in Boston on a PC that uses English United States as its regional settings. When the client of mine uses the same format no problem occurs, however i run into problems if my client is using the English (United Kingdom) format which uses dates as DMY and not MDY as the united states. Can anyone help, If yes then please instruct me... Thx in advance Quote Dream as if you'll live forever, live as if you'll die today
Moderators Robby Posted September 10, 2003 Moderators Posted September 10, 2003 Try this out... http://www.xtremedotnettalk.com/showthread.php?s=&threadid=76567 You can specify the culture within the format. Quote Visit...Bassic Software
Grimfort Posted September 10, 2003 Posted September 10, 2003 You could use a formatted date like "12 October 2003 11:11:22" the cdate() on that always brings back correct date. Quote
Mehyar Posted September 11, 2003 Author Posted September 11, 2003 Thx guys for the reply.. Ok so i get my server date as a string (in USA format) example "9/11/2003" i want to compare this date to a machine using the english format, I am using the DateDiff function.. I cannot change the server date which is a string to date because it will be interpreted as a 9 november not 11 september. How can i solve this.... Quote Dream as if you'll live forever, live as if you'll die today
pendragon Posted September 11, 2003 Posted September 11, 2003 Don't know if there is an easier way of doing it but this shoud work. You need the following imports Imports System.Globalization Imports System.Threading then Dim dDate As Date Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US") dDate = CDate(YourDateString) Thread.CurrentThread.CurrentCulture = New CultureInfo("en-GB") dDate should now be English Quote
pendragon Posted September 11, 2003 Posted September 11, 2003 Forgot to add that you might want to check the help on the cultureinfo property as microsoft always says that 'Manipulating threads is dangerous' and I wouldn'y want you to mess up your program. Quote
Mehyar Posted September 12, 2003 Author Posted September 12, 2003 Pendragon, I just tried your example ... It bloody works !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you my friend I really appreciate it, It has been a long time now I was trying to solve this. Thx a million buddy..... Quote Dream as if you'll live forever, live as if you'll die today
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.