Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Convert date recevied as String to date in local time zone (http://www.velocityreviews.com/forums/t501923-convert-date-recevied-as-string-to-date-in-local-time-zone.html)

deepak_kamath_n@yahoo.co.in 04-28-2007 04:12 AM

Convert date recevied as String to date in local time zone
 
Hello,

I have the following scenario:
1. My application receives the date from another application as a
string
2. The other application is running in a different time zone as
compared to my app.
3. I need to convert the received date string in to a date w.r.t my
local time zone.

For e.g., the string I recv is : "Mon Oct 16 16:20:06 EDT 2006"
How do I convert this to a date w.r.t my local timezone?

Any help on this is much appreciated!

Regards,
Deepu


Dennis Jones 04-28-2007 05:02 AM

Re: Convert date recevied as String to date in local time zone
 

<deepak_kamath_n@yahoo.co.in> wrote in message
news:1177733545.908281.62300@y5g2000hsa.googlegrou ps.com...
> Hello,
>
> I have the following scenario:
> 1. My application receives the date from another application as a
> string
> 2. The other application is running in a different time zone as
> compared to my app.
> 3. I need to convert the received date string in to a date w.r.t my
> local time zone.
>
> For e.g., the string I recv is : "Mon Oct 16 16:20:06 EDT 2006"
> How do I convert this to a date w.r.t my local timezone?


First convert the received time to UTC, then convert from UTC to your local
time zone.

- Dennis



deepak_kamath_n@yahoo.co.in 04-29-2007 04:26 AM

Re: Convert date recevied as String to date in local time zone
 
Which function can I use to convert the date "Mon Oct 16 16:20:06 EDT
2006" to UTC? The problem is I could not find a fucntion that takes
time timezone(in this case "EDT") as an input parameter and gives me
the corresponding UTC.

On Apr 28, 10:02 am, "Dennis Jones" <nos...@nospam.com> wrote:
> <deepak_kamat...@yahoo.co.in> wrote in message
>
> news:1177733545.908281.62300@y5g2000hsa.googlegrou ps.com...
>
> > Hello,

>
> > I have the following scenario:
> > 1. My application receives the date from another application as a
> > string
> > 2. The other application is running in a different time zone as
> > compared to my app.
> > 3. I need to convert the received date string in to a date w.r.t my
> > local time zone.

>
> > For e.g., the string I recv is : "Mon Oct 16 16:20:06 EDT 2006"
> > How do I convert this to a date w.r.t my local timezone?

>
> First convert the received time to UTC, then convert from UTC to your local
> time zone.
>
> - Dennis




osmium 04-29-2007 01:16 PM

Re: Convert date recevied as String to date in local time zone
 
<deepak_kamath_n@yahoo.co.in> wrote:

> Which function can I use to convert the date "Mon Oct 16 16:20:06 EDT
> 2006" to UTC? The problem is I could not find a fucntion that takes
> time timezone(in this case "EDT") as an input parameter and gives me
> the corresponding UTE.


In the time you have wasted looking for some code, you could have written
the code yourself! Start coding.



=?ISO-8859-1?Q?Erik_Wikstr=F6m?= 04-29-2007 03:41 PM

Re: Convert date recevied as String to date in local time zone
 
On 2007-04-29 15:16, osmium wrote:
> <deepak_kamath_n@yahoo.co.in> wrote:
>
>> Which function can I use to convert the date "Mon Oct 16 16:20:06 EDT
>> 2006" to UTC? The problem is I could not find a fucntion that takes
>> time timezone(in this case "EDT") as an input parameter and gives me
>> the corresponding UTE.

>
> In the time you have wasted looking for some code, you could have written
> the code yourself! Start coding.


Well, almost true but timezons complicates a lot of things when DST is
considered (especially over in the US where every county seems to have
it their own way).

--
Erik Wikström

osmium 04-29-2007 04:00 PM

Re: Convert date recevied as String to date in local time zone
 
"Erik Wikström" wrote:

> On 2007-04-29 15:16, osmium wrote:
>> <deepak_kamath_n@yahoo.co.in> wrote:
>>
>>> Which function can I use to convert the date "Mon Oct 16 16:20:06 EDT
>>> 2006" to UTC? The problem is I could not find a fucntion that takes
>>> time timezone(in this case "EDT") as an input parameter and gives me
>>> the corresponding UTE.

>>
>> In the time you have wasted looking for some code, you could have written
>> the code yourself! Start coding.

>
> Well, almost true but timezons complicates a lot of things when DST is
> considered (especially over in the US where every county seems to have it
> their own way).


The example he posted showed EDT which has a nice fixed relationship to UTC.
So someone has already solved the problem you allude to.



deepak_kamath_n@yahoo.co.in 04-30-2007 02:43 AM

Re: Convert date recevied as String to date in local time zone
 
My requirement is *not* just to convert a date string in "EDT" time
zone to UTC ( if it were this post would not exist at all).

I may get the date string from any time zone and I need to convert
this to UTC. Now to do this, I need to know the offset of the time
zone in question from UTC, the abbreviation such as EDT would not
suffice.

Is there any API that provides me with the offset for a given
abbreviated timezone or is creating a database of such offsets and
using it the only option?

--Deepu


On Apr 29, 9:00 pm, "osmium" <r124c4u...@comcast.net> wrote:
> "Erik Wikström" wrote:
> > On 2007-04-29 15:16, osmium wrote:
> >> <deepak_kamat...@yahoo.co.in> wrote:

>
> >>> Which function can I use to convert the date "Mon Oct 16 16:20:06 EDT
> >>> 2006" to UTC? The problem is I could not find a fucntion that takes
> >>> time timezone(in this case "EDT") as an input parameter and gives me
> >>> the corresponding UTE.

>
> >> In the time you have wasted looking for some code, you could have written
> >> the code yourself! Start coding.

>
> > Well, almost true but timezons complicates a lot of things when DST is
> > considered (especially over in the US where every county seems to have it
> > their own way).

>
> The example he posted showed EDT which has a nice fixed relationship to UTC.
> So someone has already solved the problem you allude to.




=?ISO-8859-1?Q?Erik_Wikstr=F6m?= 04-30-2007 08:17 AM

Re: Convert date recevied as String to date in local time zone
 
On 2007-04-30 04:43, deepak_kamath_n@yahoo.co.in wrote:
> My requirement is *not* just to convert a date string in "EDT" time
> zone to UTC ( if it were this post would not exist at all).
>
> I may get the date string from any time zone and I need to convert
> this to UTC. Now to do this, I need to know the offset of the time
> zone in question from UTC, the abbreviation such as EDT would not
> suffice.
>
> Is there any API that provides me with the offset for a given
> abbreviated timezone or is creating a database of such offsets and
> using it the only option?


As I said, DST makes a mess of this since the offset depends partially
on what date it is, however I suspect that all platforms except some
embedded ones will have some way of converting between different times,
ask in a group for your platform and you'll probably get an answer.

--
Erik Wikström

Boris 05-01-2007 12:26 PM

Re: Convert date recevied as String to date in local time zone
 
On Sat, 28 Apr 2007 06:12:25 +0200, <deepak_kamath_n@yahoo.co.in> wrote:

> Hello,
>
> I have the following scenario:
> 1. My application receives the date from another application as a
> string
> 2. The other application is running in a different time zone as
> compared to my app.
> 3. I need to convert the received date string in to a date w.r.t my
> local time zone.
>
> For e.g., the string I recv is : "Mon Oct 16 16:20:06 EDT 2006"
> How do I convert this to a date w.r.t my local timezone?


You might want to have a look at
http://www.boost.org/doc/html/date_time.html.

Boris


All times are GMT. The time now is 11:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57