SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 14th, 2004, 08:47 AM
stevie17 stevie17 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 59 stevie17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Date Format Change

I have a form in my web page that everyone enters in a date and clicks submit. On the click of submit button the date is sent to the sql server and runs a stored procedure. My problem is that everyone enters the date in a dd/mm/yy format. The sql server needs the date to be entered in a yyyy/mm/dd for the stored procedure to run.

Is there any code which I can run in order to change the date format around (FROM dd/mm/yy -- TO -- yyyy/mm/dd) on the onclick event of the submit button on my form.
The html code for my form is as follows
<form action="" method="post" name="accounting" id="accounting">
<input name="date" type="text" id="date">
<input type="submit" name="Submit" value="Submit">
</form>

I would really appreciate any help anyone can give to me as I am very new to any type of coding and find it difficult doing some of the simple things.
Thanks
Not even sure if asp is needed to do this. All I know is the page is as asp.

Reply With Quote
  #2  
Old April 15th, 2004, 04:42 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 19 h 31 m 41 sec
Reputation Power: 180
You could convert the date to a string, and once you have "dd/mm/yy" you can split the string on "/" to get the components of the date.

Then reassemble in the format you want.
Code:
sDate = "25/05/02"
myArray = Split(sDate, "/")
' Do some code to fix myArray(2) to a 4-digit year
sNewDate = myArray(2) & "/" & myArray(1) & "/" & myArray(0)


I haven't tested this you may need to tweak the code some.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Date Format Change


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway