Re: Date Format on Pocket PC by Gary
Gary
Sun Jan 02 05:49:18 CST 2005
You mentioned "I use the DateTimePicker " in your original post, so I
assumed you had a similar environment that I use.
Using UTC for example I pick this moments date and time, which is Pacific
time here, the UTC time will be + 8 hours. If it is 2 am here, it is 10 am
in the UTC time. If you always convert the dates you use (the dates your
users are returning in their DateTimePicker) then you shouldn't have
problems with your query.
Using this code...
------------------------------
Public Class Form1
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim MyDate, MyUtcDate As Date
MyDate = Me.DateTimePicker1.Value
MyUtcDate = MyDate.ToUniversalTime()
End Sub
End Class
------------------------------
My Computer Clock set to Pacific Time (using the debugger to see the values)
MyDate #1/27/2005 3:31:03 AM# Date
MyUtcDate #1/27/2005 11:31:03 AM# Date
---------------------------------------
My Computer Clock set to London Time (GMT)
MyDate #1/27/2005 11:34:42 AM# Date
MyUtcDate #1/27/2005 11:34:42 AM# Date
As you can see, the UTC date will be consistent for your use in your query.
Note that I have never used Visual Basic before. Fortunately I have had to
convert a few samples to C#, or C++ so have a good familiarity with it. Also
articles that show both Visual Basic and C# helps to see where any
differences are.
I had better remember to change my clock back to the right time. :-)
" A_PK" <pk999@hotmail.com> wrote in message
news:Oa$SgUu7EHA.1400@TK2MSFTNGP11.phx.gbl...
> sorry.....VB.net for pocket pc....no DateTimePicker.....
> so how to identify that my system is UK or US date ?
> "Gary Mount" <gary_mount@hotmail.com> wrote in message
> news:e2CPYml7EHA.2804@TK2MSFTNGP15.phx.gbl...
>> In my Pocket PC developer environment, (Visual Studio .NET 2003 / 2005
>> beta 1) The DateTimePicker uses a DateTime as the Value property. Use
>> DateTime and this should simplify what you are trying to do. Use
>> coordinated universal time (UTC) .
>>
>> " A_PK" <pk999@hotmail.com> wrote in message
>> news:OnRf1ik7EHA.2552@TK2MSFTNGP09.phx.gbl...
>>> Hi,
>>>
>>> I am facing Date Format problem.....
>>> US and UK are using different date format.....MM/DD/YYYY and DD/MM/YYYY
>>>
>>> so when i am developing my application, I have encountered some problems
>>> when I query my data using date as a criteria.
>>>
>>> I use the DateTimePicker for user to drop down to choose the date. when
>>> the user selected the particular date, i tried to make a search using
>>> that date. I will encounter Date Format problem....
>>>
>>> If I set my regional setting under US system, meaning MM/DD/YYYY, then
>>> no problem
>>> if I set my regional setting under UK system , meaning DD/MM/YYYY, then
>>> my query will have problem
>>>
>>> Please guide me how to overcome this problem. Cos I never know what
>>> regional setting my user will set.
>>>
>>
>>
>
>