473,382 Members | 1,705 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,382 software developers and data experts.

Culter + Date Format in MM/DD/YYYY Database - how to force a single format?

Chu
In playing with asp.net 2.0, I've been impressed with the
internationalization support that's built right in. It's great that I
can simply add a tag to my page's directive and it magically transforms
all dates into my end user's date format. However, it's causing a
problem that I've yet to find a cure for:

My server is located in the US, where we obviously use the date format
MM/DD/YYYY. I use DateTime.Now through my code which works great until
the client's system is setup to use another format, such as DD/MM/YYYY
-- then the database gets fed the wrong date format. Is there a way I
can tell, or format DateTime.Now back into a specific format for my
database?

Aug 14 '06 #1
3 2048
myDate.Tostring("MM/dd/yyyy")

Shawn

"Chu" <ry********@thescottclan.netwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
In playing with asp.net 2.0, I've been impressed with the
internationalization support that's built right in. It's great that I
can simply add a tag to my page's directive and it magically transforms
all dates into my end user's date format. However, it's causing a
problem that I've yet to find a cure for:

My server is located in the US, where we obviously use the date format
MM/DD/YYYY. I use DateTime.Now through my code which works great until
the client's system is setup to use another format, such as DD/MM/YYYY
-- then the database gets fed the wrong date format. Is there a way I
can tell, or format DateTime.Now back into a specific format for my
database?
Aug 14 '06 #2
Chu
Isn't there an easier way to do it? I'd have to go back to many places
in the code just to make that change.

I guess this brings up the point of best practices when using dates in
code. Generally speaking, how is it normally handled? Is there someone
to just get the server's "Now" time in the server's culture?
Shawn wrote:
myDate.Tostring("MM/dd/yyyy")

Shawn

"Chu" <ry********@thescottclan.netwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
In playing with asp.net 2.0, I've been impressed with the
internationalization support that's built right in. It's great that I
can simply add a tag to my page's directive and it magically transforms
all dates into my end user's date format. However, it's causing a
problem that I've yet to find a cure for:

My server is located in the US, where we obviously use the date format
MM/DD/YYYY. I use DateTime.Now through my code which works great until
the client's system is setup to use another format, such as DD/MM/YYYY
-- then the database gets fed the wrong date format. Is there a way I
can tell, or format DateTime.Now back into a specific format for my
database?
Aug 14 '06 #3
Maybe Session.LCID is what you need.
http://www.google.com/search?sourcei...session%2ELCID

Shawn

"Chu" <ry********@thescottclan.netwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Isn't there an easier way to do it? I'd have to go back to many places
in the code just to make that change.

I guess this brings up the point of best practices when using dates in
code. Generally speaking, how is it normally handled? Is there someone
to just get the server's "Now" time in the server's culture?
Shawn wrote:
myDate.Tostring("MM/dd/yyyy")

Shawn

"Chu" <ry********@thescottclan.netwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
In playing with asp.net 2.0, I've been impressed with the
internationalization support that's built right in. It's great that I
can simply add a tag to my page's directive and it magically transforms
all dates into my end user's date format. However, it's causing a
problem that I've yet to find a cure for:

My server is located in the US, where we obviously use the date format
MM/DD/YYYY. I use DateTime.Now through my code which works great until
the client's system is setup to use another format, such as DD/MM/YYYY
-- then the database gets fed the wrong date format. Is there a way I
can tell, or format DateTime.Now back into a specific format for my
database?

Aug 15 '06 #4

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

Similar topics

2
by: rp | last post by:
Hi, I have a form in which I do a number of checks using javascript to make sure the date is posted as DD/MM/YY. But when I then get the ASP side of running checks and updating data the date...
1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
3
by: Lin Ma | last post by:
In my asp page, I have a date value from SQL database and I would like to be formatted like: yyyy,mm,dd. Such as 1/22/2005 to be 2005,1,22 Is there a simple command I can use? Thanks,
2
by: Tatiana Zadiraka | last post by:
I use DB2 8.1 with FixPack 5. In command line for sql I get all DATE columns only in MM-DD-YYYY format. Of course, DATE('20-12-2003') gives me an error SQL0181N The string representation of a...
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
9
by: Jozef Jarosciak | last post by:
I have an application which imports fields from external source where date format of one the collumns is English (United States): M/d/yyyy. So July 1, 2005 equals to: 7/1/05 I am using this date...
7
by: Middletree | last post by:
I am trying to display dates in a spreadsheet, but the dates need to be in a format that will allow them to be sorted in Excel. The datatype in the SQL Server database is datetime. In this case, I...
21
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.