Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek 9 9302
So you want 8 AM no matter what time zone you are in? If that is the
case, then just create a format string when calling ToString which does not
have the timezone information in it (or an offset from GMT), and it should
work.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Abhishek" <lu***********@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
So you want 8 AM no matter what time zone you are in? If that is the
case, then just create a format string when calling ToString which does not
have the timezone information in it (or an offset from GMT), and it should
work.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek
Right, that's because you have the "GMT" part in your string. Create a
format which doesn't have the "GMT" part in it and it should have no choice
but to assume local time.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Abhishek" <lu***********@gmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
> So you want 8 AM no matter what time zone you are in? If that is the case, then just create a format string when calling ToString which does not have the timezone information in it (or an offset from GMT), and it should work.
-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11**********************@q69g2000hsb.googleg roups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek
On Jun 18, 8:58 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Right, that's because you have the "GMT" part in your string. Create a
format which doesn't have the "GMT" part in it and it should have no choice
but to assume local time.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
So you want 8 AM no matter what time zone you are in? If that is the
case, then just create a format string when calling ToString which does
not
have the timezone information in it (or an offset from GMT), and it
should
work.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
>news:11**********************@q69g2000hsb.googleg roups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek- Hide quoted text -
- Show quoted text -
Do you mean i should have a string "2007-05-14T08:00:00.000Z" instead
of "2007-05-14T08:00:00.000+02:30" ?
~Abhishek
Abishek,
That would be UNC time. What about a format of
"2007-05-14T08:00:00.000" or "2007-05-14 08:00:00.000".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Abhishek" <lu***********@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
On Jun 18, 8:58 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
> Right, that's because you have the "GMT" part in your string. Create a format which doesn't have the "GMT" part in it and it should have no choice but to assume local time.
-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11**********************@n60g2000hse.googleg roups.com...
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote: So you want 8 AM no matter what time zone you are in? If that is the case, then just create a format string when calling ToString which does not have the timezone information in it (or an offset from GMT), and it should work.
>-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
>"Abhishek" <luckyabhis...@gmail.comwrote in message
>>news:11**********************@q69g2000hsb.google groups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
>- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek- Hide quoted text -
- Show quoted text -
Do you mean i should have a string "2007-05-14T08:00:00.000Z" instead
of "2007-05-14T08:00:00.000+02:30" ?
~Abhishek
On Jun 18, 9:48 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Abishek,
That would be UNC time. What about a format of
"2007-05-14T08:00:00.000" or "2007-05-14 08:00:00.000".
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
On Jun 18, 8:58 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Right, that's because you have the "GMT" part in your string. Create
a
format which doesn't have the "GMT" part in it and it should have no
choice
but to assume local time.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
>news:11**********************@n60g2000hse.googleg roups.com...
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
So you want 8 AM no matter what time zone you are in? If that is
the
case, then just create a format string when calling ToString which
does
not
have the timezone information in it (or an offset from GMT), and it
should
work.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
>news:11**********************@q69g2000hsb.googleg roups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek- Hide quoted text -
- Show quoted text -
Do you mean i should have a string "2007-05-14T08:00:00.000Z" instead
of "2007-05-14T08:00:00.000+02:30" ?
~Abhishek- Hide quoted text -
- Show quoted text -
This is kind of tricky. I've this string coming in as part of SOAP
Response in IBF call and i can't change the server part of the
application.
Basically the SOAP Serializer on the server side serializes a Java
Calendar object to achieve this result and i definitely have very
little control on that serializer.
Any other way ?
~Abhishek
Abhishek,
In this case, you will have to take the offset that you are in (+5.5
hours) and subtract it from the offset the time came from (+2.5 hours) for a
difference of -3 hours. You then apply that to the time in local time on
your machine (11 am) and you will get the local time (8 am).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Abhishek" <lu***********@gmail.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
On Jun 18, 9:48 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Abishek,
That would be UNC time. What about a format of "2007-05-14T08:00:00.000" or "2007-05-14 08:00:00.000".
-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
"Abhishek" <luckyabhis...@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegr oups.com...
On Jun 18, 8:58 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote: Right, that's because you have the "GMT" part in your string. Create a format which doesn't have the "GMT" part in it and it should have no choice but to assume local time.
>-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
>"Abhishek" <luckyabhis...@gmail.comwrote in message
>>news:11**********************@n60g2000hse.google groups.com...
On Jun 18, 8:08 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote: So you want 8 AM no matter what time zone you are in? If that is the case, then just create a format string when calling ToString which does not have the timezone information in it (or an offset from GMT), and it should work.
>-- - Nicholas Paldino [.NET/C# MVP] - m...@spam.guard.caspershouse.com
>"Abhishek" <luckyabhis...@gmail.comwrote in message
>>news:11**********************@q69g2000hsb.google groups.com...
Hi
I am trying to deserialize/ Parse a datetime object with the
below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30
time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT +
5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to
achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Any help would be appreciated a lot.
Thanks, Abhishek- Hide quoted text -
>- Show quoted text -
Hi Nicholas
It would work as long as i am in GMT + 2.30
As soon as i switch my system time zone to GMT + 5.30 it would start
giving me 11.00 AM which is a problem for me
~Abhishek- Hide quoted text -
>- Show quoted text -
Do you mean i should have a string "2007-05-14T08:00:00.000Z" instead
of "2007-05-14T08:00:00.000+02:30" ?
~Abhishek- Hide quoted text -
- Show quoted text -
This is kind of tricky. I've this string coming in as part of SOAP
Response in IBF call and i can't change the server part of the
application.
Basically the SOAP Serializer on the server side serializes a Java
Calendar object to achieve this result and i definitely have very
little control on that serializer.
Any other way ?
~Abhishek
On Mon, 18 Jun 2007 06:01:02 -0700, Abhishek <lu***********@gmail.com>
wrote:
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Maybe you can clarify the behavior you want. If you are not in timezone
+02:30, and you want the time displayed in your local time, it's not clear
to me why you want the final display to be shown as 08:00:00 in your local
time zone. That's not the same time that you were given in the string.
IMHO, one of the cleanest ways to deal with this is to parse the time as
universal time, and then convert to local or to other timezones as needed
(which may not be necessary at all, depending on what you're doing with
it).
Use the DateTimeStyles.AdjustToUniversal as a parameter to
DateTime.Parse() to have the timezone offset included in the parsing and
applied so that the resulting DateTime object is a Utc type. At that
point, you have the correct time represented as Universal time. Then you
can convert it as appropriate to a different timezone (for example, the
local time, or the original timezone of offset +02:30).
Pete
On Jun 18, 11:04 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Mon, 18 Jun 2007 06:01:02 -0700, Abhishek <luckyabhis...@gmail.com>
wrote:
I am trying to deserialize/ Parse a datetime object with the below
string "2007-05-14T08:00:00.000+02:30" . If i am in GMT + 2.30 time
zone everything's fine however if i am in GMT + 5.30 i get the
DateTime object which represents 11.00 AM.
Now this is perfectly fine as if i go from GMT +2.30 tp GMT + 5.30 ,
8.00 AM becomes 11.00 AM. however this is not what i want to achieve
in my program.
What i want to achieve is to reconstruct a date time object which
gives me the 8.00 AM as clock time.
Maybe you can clarify the behavior you want. If you are not in timezone
+02:30, and you want the time displayed in your local time, it's not clear
to me why you want the final display to be shown as 08:00:00 in your local
time zone. That's not the same time that you were given in the string.
IMHO, one of the cleanest ways to deal with this is to parse the time as
universal time, and then convert to local or to other timezones as needed
(which may not be necessary at all, depending on what you're doing with
it).
Use the DateTimeStyles.AdjustToUniversal as a parameter to
DateTime.Parse() to have the timezone offset included in the parsing and
applied so that the resulting DateTime object is a Utc type. At that
point, you have the correct time represented as Universal time. Then you
can convert it as appropriate to a different timezone (for example, the
local time, or the original timezone of offset +02:30).
Pete
Hi Pete
I understand what you are saying however i can;t really do what you
are suggesting. The reason being that i am working on an application
which is timezone aware on the frontend e.g. Outlook however my
backend is time zone unaware.
Now to overcome this limitation what we've decided is to actually
transfer the date time over the wire in the above format where the
bacend only stores the clock time. Now since .NET serializer always
serializes the DateTime in the above format my problem is solved.
however when i need to display the time to the user and if he has
changed his time zone i still need to display the clock time which has
been recorded in the backend.
I can't really work in all UTC because we've plans to modify our
backend to be timezone aware and consider the timezones as well. So to
maintain the forward compatibility i need to make sure that actual
stuff goes over the wire.
~Abhishek This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Symon R |
last post by:
This is a bit of a weird one that I haven't yet been able to solve - I'm
hoping someone out there can disprove my findings and tell me where I've
gone wrong!
I have designed a web service that...
|
by: Snowman |
last post by:
Suppose I have a RootObject which holds a collection of other objects.
The other objects have a property (Parent) which refers back to the "parent"
collection (b.t.w. my collection is based on...
|
by: parrot toes |
last post by:
Summary:
I have been trying to make requests of a web service provided by Axis using
a dotnet client with code generated by wsdl.exe and have
been getting exceptions when trying to process the...
|
by: parrot toes |
last post by:
I tried to post this question before, but there was an error when posting.
I case it did get posted and in order to avoid duplication, I'll just repost
a summary.
I have written a dotnet client...
|
by: Phil B |
last post by:
I am having a problem with a datetime from a web services provider
The provider is sending the following SOAP response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope...
|
by: luckyabhishek |
last post by:
Hi
I am using a java webservice in a .NET application. The xml type of a
field in this webservice is xsd:datetime. When i call the webservice
from the application i get a deserialization error on...
|
by: Zachary Turner |
last post by:
Hello,
I have a situation where I would like to perform custom serialization
and deserialization of an existing .NET framework object (specifically,
System.DateTime). Is there a common paradigm...
|
by: =?Utf-8?B?YXZucmFv?= |
last post by:
We have a web service that gets data in xml format. In that Xml data, we
parse few date fields that are in this format
<data datefield="12/26/2008" timefield="16:33:45" ...>
we parse it into a...
|
by: Looch |
last post by:
All,
I'm using a WinForm app that calls methods on a remotable object. The
app server hosting the object is in New York. Using the same exact
application, a Sql Server 2005 datetime column's...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |