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

Please help, Date Format Error

Hello,

Can someone please help me?

We have developed a asp.net application which is working fine on 4 other
computers. We have recently deplyed the application to the live environment
running windows 2000 service pack 4, .NET v1.1.

We continue to get the following error "Cast from string "18/07/2003" to
type 'Date' is not valid." as the date is dmy and not mdy. We tried to
change the server's regional settings to Australia. This did not fix the
problem. We then tried to reinstall the framework. Still no luck.

Is there some setting i have to change on the server or on the framework to
use dmy date format?

Below is an example of the asp.net source that is a corse of the problem.
Please note that it is working on other servers and the work effort to
change the code is not an option:

Public Sub deletepdf(ByVal serverpath As String)
Dim fd As System.IO.DirectoryInfo
Dim fsArray As System.IO.FileInfo()
Dim i As Integer

fd = New System.IO.DirectoryInfo(serverpath + "/Temp")
fsArray = fd.GetFiles()

For i = 0 To fsArray.Length - 1
If (CDate(Format(fsArray(i).CreationTime, "dd/MM/yyyy")) <
CDate(Format(Now(), "dd/MM/yyyy"))) Then
fsArray(i).Delete()
End If
Next i

End Sub

Please help me.

Regards,

Bernard.


Nov 17 '05 #1
1 3573
Hi

First use the IsDate function to determine if date can be
converted to a date or time.

Ravikanth

-----Original Message-----
Hello,

Can someone please help me?

We have developed a asp.net application which is working fine on 4 othercomputers. We have recently deplyed the application to the live environmentrunning windows 2000 service pack 4, .NET v1.1.

We continue to get the following error "Cast from string "18/07/2003" totype 'Date' is not valid." as the date is dmy and not mdy. We tried tochange the server's regional settings to Australia. This did not fix theproblem. We then tried to reinstall the framework. Still no luck.
Is there some setting i have to change on the server or on the framework touse dmy date format?

Below is an example of the asp.net source that is a corse of the problem.Please note that it is working on other servers and the work effort tochange the code is not an option:

Public Sub deletepdf(ByVal serverpath As String)
Dim fd As System.IO.DirectoryInfo
Dim fsArray As System.IO.FileInfo()
Dim i As Integer

fd = New System.IO.DirectoryInfo(serverpath + "/Temp") fsArray = fd.GetFiles()

For i = 0 To fsArray.Length - 1
If (CDate(Format(fsArray (i).CreationTime, "dd/MM/yyyy")) <CDate(Format(Now(), "dd/MM/yyyy"))) Then
fsArray(i).Delete()
End If
Next i

End Sub

Please help me.

Regards,

Bernard.


.

Nov 17 '05 #2

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

Similar topics

10
by: Brent Webster | last post by:
This problem seems to occur dependant on the computer system settings. I have no issues when the system date is set as M/d/yyyy but I do have a problem with the system date set as d/M/yyyy. I...
11
by: milkyway | last post by:
Hello, I have an HTML page that I am trying to import 2 .js file (I created) into. These files are: row_functions.js and data_check_functions.js. Whenever I bring the contents of the files into...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
22
by: KitKat | last post by:
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to change the file name to the same folder where the file is being...
5
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
2
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
2
matrekz42
by: matrekz42 | last post by:
Hello friends, I'm trying to run this Dynamic SQL in VB, but I keep getting "Compile Error" Syntax Error, in the "Bolded" area. I'm only trying to change these fields for the second query listed,...
1
by: =?Utf-8?B?YXZucmFv?= | last post by:
We have a web service that gets data in xml format. In that Xml data, we parse few date fields that are in this format <data datefield="12/26/2008" timefield="16:33:45" ...> we parse it into a...
3
by: Lester | last post by:
I'm driving myself crazy with a problem in trying to translate a query written for Access to that for SQL server. I would think that I would use a trigger, but am not sure how to set it up. We...
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: 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...
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...

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.