Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > String to Date Conversion

Reply
Thread Tools

String to Date Conversion

 
 
RN1
Guest
Posts: n/a
 
      10-15-2008
A TextBox displays the current date (in dd/mm/yyyy format) & time when
a user comes to a page (e.g. 15/10/2008 1:36:39 PM). To convert the
date into international format so that the remote server doesn't
generate any error, this is what I am doing:

---------------------------
Dim strSDate As String
Dim strSTime As String
Dim strStartDT As String
Dim strSDateTime As String

strSDateTime = txtSDateTime.Text

i = InStr(strSDateTime, " ")
strSDate = Left(strSDateTime, i - 1)
strSTime = (Mid(strSDateTime, i + 1, Len(strSDateTime)))

strStartDT = Year(CDate(strSDate)) & "/" & Month(CDate(strSDate)) &
"/" & Day(CDate(strSDate)) & " " & strSTime
---------------------------

The above works perfectly on my local server but on the remote server,
the last line in the above code generates the following error:

--------------------------
Conversion from string "15/10/2008" to type 'Date' is not valid.
--------------------------

What am I doing wrong?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ordinal Date String to Standard Date String for a Beginner davyb Ruby 7 11-18-2005 08:54 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Calling date conversion function before binding the date to a daragrid Sanjeeb ASP .Net Web Controls 2 01-26-2004 06:36 AM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57