Solved

regional settings - ASP and IIS

Posted on 2008-10-01
2
699 Views
Last Modified: 2012-05-05
How will IIS treat the regional language setting ? I have a web app, within the asp page, I have certain date fields. These are bound to datetime fields (ado types) in com objects. When a user enters 01/02/2008 and the regional setting is mm/dd/yyyy then it will be sent
to sql server as January 02 2008. My question is what will happen if a user logged from UK saves a record ? Will this be February 1st 2008 (dd/mm/yyyy) in the business object? These are com dlls. My webserver control panel regional setting has a format of mm/dd/yyyy.
0
Comment
Question by:tech_question
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
slamhound earned 500 total points
ID: 22621052
This is always a big issue as I'm Australian (dd/mm/yyyy) and MS defaults everything to the US date format (mm/dd/yyyy) and I've developed a site for selling products to 15 different countries. I've found the best thing to do is to pass all dates through a function that forces their format. Two that I use regularly are included below:

Public Function DateToSQL( strDate )
      ' Takes date of form D/M/YYYY and converts to YYYY-MM-DD format for SQL use
      Dim aDate
            
      aDate = Split( strDate, "/" )
      
      If Len( aDate(1) ) = 1 Then
            aDate(1) = "0"& aDate(1)
      End If
      If Len( aDate(0) ) = 1 Then
            aDate(0) = "0"& aDate(0)
      End If
      
      DateToSQL = ""& aDate(2) &"-"& aDate(1) &"-"& aDate(0)
      
End Function

Public Function ForceDate()
    ForceDate = Day(Date()) & "/" & Month(Date()) & "/" & Year(Date())
End Function

On your site, you need to either tell the user how to enter the date which many people are fine with because the Internet is so international::
Birth Date: ______ (mm/dd/yyyy)

Or you need to check some browser variables of the user to estimate the country they are from and revamp your site to match that format. This is a very convoluted method and there's no promise that you will pick the right region or that the user will enter the date guessing at -your- date format.

So I suggest use the above code and just request the user enter one format and you show them the same format back.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB script to continue despite error 2 48
MS SQL and column defined as time 7 25
IDENTIFY, THEN ADD TOGETHER AND DELETE ONE, EXCEL 3 34
VB script help 23 30
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question