473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

date to text formats - neverending story

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
Nov 18 '05 #1
3 1420
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" <le***@keshet-i.com> wrote in message
news:c6**********@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

Nov 18 '05 #2
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" <dj*****@houston.rr.com> wrote in message
news:O5**************@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" <le***@keshet-i.com> wrote in message
news:c6**********@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


Nov 18 '05 #3
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" <le***@keshet-i.com> wrote in message
news:c6**********@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" <dj*****@houston.rr.com> wrote in message
news:O5**************@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" <le***@keshet-i.com> wrote in message
news:c6**********@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
>
>



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
26
by: sgershon | last post by:
Hi. I know this is should be a simple question. I know server-side web-programming, and never needed to use client-side scripting... until now :) I have done so far a little number of scripts...
36
by: Martin Herrman | last post by:
Dear scripters, I am working on a HTML form in which a date must be entered of the form 'dd-mm-yyyy'. Now I'm looking for a script that, when the user switches to another form field, changes...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
3
by: Mike Dundee | last post by:
I am importing data into a new database (the database still has to be set up) and have a problem. The comma delimited text files I am importing have four fields containing date and date/times. ...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
4
by: Terry | last post by:
I have a TextBox with a date such as 15/01/2006 which I want to cast into a variable as a short date 15/01/06, also I need to cast a time such as 07:30 A.M. into a variable as a short time. What...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.