For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > April 2004 > date to text formats - neverending story









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author date to text formats - neverending story
Leo Muller

2004-04-29, 3:16 am

Hi,

Very often I have a problem with date formats.
There are cases I have to cast the date to text and from text to date on a
different server. However, sometimes the date formats on the servers are
different and this doesn't always work. Also on my development environment
this is hard to detect, because here all the servers have the same date
format.

Is there any way of avoiding this problem programmatically, once and
forever, without setting all settings the same?

Thanks,

Leo


David Jessee

2004-04-29, 3:16 am

I'd make sure that whenever the date is being exchanged between systems you
just make sure its a date. That way if one server needs to turn it into
text, it can do it, but if it needs to sent a value to another server
(middle tier, or whatever) it always sends that value as a date.

This way you're passing around Quantified information (the VALUE of a date)
as opposed to a Qualified information (a String that represents a date for a
given culture and display format).


"Leo Muller" <leo-m@keshet-i.com> wrote in message
news:c6q2he$ne4$1@news2.netvision.net.il...
> Hi,
>
> Very often I have a problem with date formats.
> There are cases I have to cast the date to text and from text to date on a
> different server. However, sometimes the date formats on the servers are
> different and this doesn't always work. Also on my development environment
> this is hard to detect, because here all the servers have the same date
> format.
>
> Is there any way of avoiding this problem programmatically, once and
> forever, without setting all settings the same?
>
> Thanks,
>
> Leo
>
>



Leo Muller

2004-04-29, 3:16 am

How would I do this if, for example, the end users has to type in a date (or
update), through a text field?

Leo

"David Jessee" <djessee@houston.rr.com> wrote in message
news:O5ZqDkaLEHA.3324@TK2MSFTNGP10.phx.gbl...
> I'd make sure that whenever the date is being exchanged between systems

you
> just make sure its a date. That way if one server needs to turn it into
> text, it can do it, but if it needs to sent a value to another server
> (middle tier, or whatever) it always sends that value as a date.
>
> This way you're passing around Quantified information (the VALUE of a

date)
> as opposed to a Qualified information (a String that represents a date for

a
> given culture and display format).
>
>
> "Leo Muller" <leo-m@keshet-i.com> wrote in message
> news:c6q2he$ne4$1@news2.netvision.net.il...
a[color=darkred]
environment[color=darkred]
>
>



avnrao

2004-04-29, 2:05 pm

guess you are showing the date format that end users have to type
(MM/DD/YYYY)
once you access the text value from text box convert it to the format you
need and check it satisfies.

use DateTime.Parse or ParseExact.

Av.

"Leo Muller" <leo-m@keshet-i.com> wrote in message
news:c6q48m$nl7$1@news2.netvision.net.il...
> How would I do this if, for example, the end users has to type in a date
> (or
> update), through a text field?
>
> Leo
>
> "David Jessee" <djessee@houston.rr.com> wrote in message
> news:O5ZqDkaLEHA.3324@TK2MSFTNGP10.phx.gbl...
> you
> date)
> a
> a
> environment
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com