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.

Re: Date Format on Pocket PC by Gary

Gary
Thu Dec 30 04:23:14 CST 2004

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.
>



Re: Date Format on Pocket PC by A_PK

A_PK
Thu Dec 30 08:08:29 CST 2004

Sorry....I am not familiar with UTC and DateTime..
could you explain more in detail...cause I dun understand..
Thank you


"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.
>>
>
>



Re: Date Format on Pocket PC by A_PK

A_PK
Thu Dec 30 21:02:04 CST 2004

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.
>>
>
>



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.
>>>
>>
>>
>
>



Re: Date Format on Pocket PC by Gary

Gary
Sun Jan 02 07:14:19 CST 2005

You mention the problem is in the regional formatting of the date. If the
method of using the date that I wrote in my previous post still doesn't work
for you, because you are writing your code in such a way that you are
actually using the formatting of the date, then you will have to write a lot
more code to handle all the different ways that dates can be formatted.
You can use the Hour, Minute, etc properties of the Date class to get those
particular values if that is the purpose of the query type of code you are
currently using and having problems with.
I notice there are about 123 regional settings available in my copy of
Windows XP. I don't have my Pocket pc handy at the moment to check how many
on the device.
Now that I think about it, I can use the emulator on my computer, there are
86 regional settings in the Pocket PC 2003 emulator.
You can also save your dates as Long types

Dim MyLong As Long = MyDate.Ticks

Dim MyNewDate As Date = New Date(MyLong)

and in the debugger after executing the previous lines...
MyDate #1/26/2005 5:05:57 AM# Date
MyLong 632423127570000000 Long
MyNewDate #1/26/2005 5:05:57 AM# Date



>>>
>>> " 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.
>>>>
>>>
>>>
>>
>>
>
>