473,804 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

White space issue when parsing datetime Options

Hi All,

i have two accepted formats.
expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
tt"}
dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
culture.DateTim eFormat,
Globalization.D ateTimeStyles.A llowWhiteSpaces )
and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
space between year and time) and i am pretty sure zero lenght string
is not a white space.
Please help

Jun 8 '07 #1
3 2930
Are you saying that you want the parsing to fail in that situation?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"parez" <ps*****@gmail. comwrote in message
news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
Hi All,

i have two accepted formats.
expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
tt"}
dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
culture.DateTim eFormat,
Globalization.D ateTimeStyles.A llowWhiteSpaces )
and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
space between year and time) and i am pretty sure zero lenght string
is not a white space.
Please help
Jun 9 '07 #2
Sorry about that!!
Yes i am saying it should fail
On Jun 9, 3:53 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Are you saying that you want the parsing to fail in that situation?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om"parez" <psaw...@gmail. comwrote in message

news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
Hi All,
i have two accepted formats.
expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
tt"}
dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
culture.DateTim eFormat,
Globalization.D ateTimeStyles.A llowWhiteSpaces )
and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
space between year and time) and i am pretty sure zero lenght string
is not a white space.
Please help- Hide quoted text -

- Show quoted text -

Jun 11 '07 #3
AllowWhiteSpace means "be flexible with whitespace". Remove that option.

"parez" <ps*****@gmail. comwrote in message
news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
Sorry about that!!
Yes i am saying it should fail
On Jun 9, 3:53 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
> Are you saying that you want the parsing to fail in that situation?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om"parez" <psaw...@gmail. com>
wrote in message

news:11******* *************** @p77g2000hsh.go oglegroups.com. ..
Hi All,
i have two accepted formats.
expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss
tt"}
dt = DateTime.ParseE xact(txtInpDate String.Text, expectedFormats ,
culture.DateTim eFormat,
Globalization.D ateTimeStyles.A llowWhiteSpaces )
and i get 05/14/200711:22:33 AM as a valid date. (Note: there is no
space between year and time) and i am pretty sure zero lenght string
is not a white space.
Please help- Hide quoted text -

- Show quoted text -

Jun 11 '07 #4

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

Similar topics

8
9449
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 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
2
4265
by: \Dandy\ Randy | last post by:
Hello everyone. I have been following misc posts, as well as reading several FAQ's on this issue, unfortunatley I cannot locate a solution. I am hoping that someone will be able to provide me with the simple answer. My problem has to do with the leading white spaces after the first line when calling data using the @ variable. Here is my code: open (PREVIEW, "<preview.txt") or &error("Unable to open the data file for reading"); flock...
6
4842
by: Ot | last post by:
I have an xml document similar to this <all> <one> <options attr1="1" attr2="2" /> <item name="a name" attr1="1" /> <item name="another" attr1="2"/> </one> <two> <options attr1="1" attr2="2" />
6
31190
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date format exception (SQLSTATE=22007). The same queries worked fine on all the other workstations. The date format we want to use is "dd/mm/yyyy".After reinstalling several times the db2 runtime client w/ different options, we found on a technical forum...
1
1335
by: psawant | last post by:
Hi All, i have two accepted formats. expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss tt"} dt = DateTime.ParseExact(txtInpDateString.Text, expectedFormats,
1
1176
by: parez | last post by:
Hi All, i have two accepted formats. expectedFormats = New String() {"%M/%d/yyyy", "%M/%d/yyyy hh:mm:ss tt"} dt = DateTime.ParseExact(txtInpDateString.Text, expectedFormats, culture.DateTimeFormat, Globalization.DateTimeStyles.AllowWhiteSpaces)
5
2578
by: Richard Maher | last post by:
Hi, Can someone please show me how to tell Firefox to preseve white-space when returning the selectList.option.value attribute? I have change the style so that the white-space is preserved on the screen, but for some bizarre reason when I try to substring out a series of bytes (aka a fixed-length string or field) from a given option it squashes everything up and corrupts the result.
7
2413
by: Daniel Fetchinson | last post by:
Many times a more user friendly date format is convenient than the pure date and time. For example for a date that is yesterday I would like to see "yesterday" instead of the date itself. And for a date that was 2 days ago I would like to see "2 days ago" but for something that was 4 days ago I would like to see the actual date. This is often seen in web applications, I'm sure you all know what I'm talking about. I'm guessing this...
1
4432
by: bdbeames | last post by:
I am currently getting some forecast data from a web site using (file_get_contents), then I'm using explode to put the string in an array, which I am then parsing. The trouble is when I use explode() are several empty elements between each full one. Example. Array ( => this => is => => => a => => => test ) If I print the sting before I explode it I only see one space between each word, but the it seems to be that there is more...
0
9575
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,...
0
10564
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
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 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...
1
10308
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,...
0
10073
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
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...
1
7609
isladogs
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...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
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 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.