Hey Guys
I have a development environment, in which the whole SQL syntax is
stored in the Database.
So the syntax in the databse column could be
"where BirthDate = '12/31/2005' and ID = 345"
Note : The above string is stored and the dates are in US format. so
the dates are displayed in mm/dd/yyyy format, so when the user
retreives this record and shows it in the UI in textbox it would show
what is saved in the Databse - as the above string.
My requirement:-
If User's PC is in British Format (UK English) Locale settings then i
need to parse that string and display that in the UI.
so my expected result should show
"where BirthDate = '31/12/2005' and ID = 345"
Note: UI should show in UK format dd/mm/yyyy
So my idea is to parse the sting using regular expressions for date and
convert then to Client locale setting date format and while sending the
date back (where clause) to the databse then reconvert the string and
save it to the database in the US format.
The same goes for numbering system also. If the User PC is in italian
format then
ID = 345 should show ID = 3,45 (the way Italian format is shown).
I know how to deal with RegEx for password , email validations but not
to an extent of parsing and converting into a desired format.
Any suggestions or help would be really appreciated.
Thanks
Rahul 2 2838
I'm still pretty new to regex so this is going to be sloppy and
probably not the easiest way if it even works, but I would use
something like this after you match it:
string bdate = Regex.Match(val , "\d+/\d+/\d+").Value;
string month = Regex.Match(val , "^\d+/").Value;
string day = Regex.Match(val , "/\d+/")Value;
string year = Regex.Match(val , "/\d{4}").Value;
I'm not sure if this will work, but if it does as i intend it to,
you'll have a separate string for each part of the date, which you can
then order based on whichever d/t format you're working with. If this
doesn't work (I can't try it atm as i'm working on another project,
well, supposed to be at least) then you're going to have to make some
substrings, let me know, and if you still need help i'll take a better
stab at it.
Thanks KBUSer ,
I would try that and let you know for sure
Appreciate it
Rahul This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Babu Mannaravalappil |
last post by:
Hi,
I want to replace some words in my text files (actually transpose).
For example, I have a whole lot of expressions (words) in my files as
follows:
TABLECUSTOMERS
TABLEORDERS
TABLEORDERLINES
....
|
by: Laurence Neville |
last post by:
This is regarding a change in the Short Date format under Hebrew Regional
Settings, that has caused huge problems in our ASP web application. The
change appears to have been introduced sometime before Windows 2000 Service
Pack 4 and has remained through to Windows XP. I am looking for a solution
that doesn't involve rewriting our application (much) and that allows all
our users to keep using Hebrew Regional Settings.
To summarize our...
|
by: hungrymind |
last post by:
Hi all,
I am developing some control (textbox based), to validate inputs to
that control I am using regular expression, where pattern is generated
dynamically. I need to identify what all charcters are allowed with
that particular pattern. Is this possible or any way to solve this. Or
else, i want to identify if only one character is allowed then that
character will apear & user need not to enter any value for that.
Please suggest if...
|
by: lucky |
last post by:
hi,
i got file which contains "----------------" in a line. the line only
contains this data as a saperation. using regular expression i want to
i detify the line contains that data and replace with spaces.
if anyone has any idea,solution or link plz do share with me.
thans in advt.
Lucky
|
by: Zorik |
last post by:
I am building a form in asp.net 2.0
On one of the textboxes, I don't want that the user will use the space
character.
How do I disallow space using regular expression validator (or other
validator) ?
Thanks
ra294
| |
by: mattmao |
last post by:
Hello everyone.
This question is regarding ISBN number checking. I've done it with my own algorithm, which is pretty bad in consideration about the total lines of code.
Now I want to improve it, I guess the best practice wold be using regular expression to handle this string validation:
Say, I've got the user input string with fgets(array, 20, stdin);
If it is a valid ISBN number, then it must have a valid format:
- the valid char...
|
by: durga2005 |
last post by:
hi
I m validating a textbox using regular expression validator and these controls are placed inside the update panel
the validation is not working inside update panel
|
by: Velhari |
last post by:
Hi all,
I wrote the following Javascript function used to execute the Javascript codes from the ajax response which contains both html & javascript.
It works fine, if the javascript codes from the response doesn't have any line break at all.
function executeJSCodes( html ){
var regExp = new RegExp('<script language="javascript">(.*)<\/script>',"gi");
while( res = regExp.exec(html) ){
eval(res);
...
|
by: lordelf007 |
last post by:
Hiii all,
I'm new in using Regular Expression in Java.
For example, I have String s like this:
String s = "Why John Smith and Alan Smith and Nick Gates are the same?"
How can I get sub-strings as "John Smith", "Alan Smith", "Nick Gates" - (names of people - with first upper character) from s by using regex?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |