Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP Format Date

Posted on 2009-04-23
2
Medium Priority
?
455 Views
Last Modified: 2012-06-27
I have two strings that need to be converted before inserted into an access database. The fields that they are to be inserted are date/time.
How do I convert so that they will insert in date time format.
resdate = "somedate"
restime = "sometime"
 
insert into table (flddate, fldtime) values (resdate, restime)

Open in new window

0
Comment
Question by:wellsuited
2 Comments
 
LVL 5

Expert Comment

by:synx
ID: 24218795
You can use CDate() to convert the values to Date/Time before inserting them.  An example could be:
if IsDate(resdate) then
  resdate = CDate(resdate)
else
  document.write("Not a date/time!")
end if
 
if IsDate(restime) then
  restime= CDate(restime)
else
  document.write("Not a date/time!")
end if
 
'Now you can insert into your database

Open in new window

0
 
LVL 54

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 24221063
>>How do I convert so that they will insert in date time format.

just make sure your date value is in proper date format, so try format your date value into format of : mm/dd/yyyy  if you got an original date value in dd/mm/yyyy.

you no need to use CDate in this case.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question