Current location: Hot Scripts Forums » Programming Languages » ASP » Insert Date into Microsoft Access


Insert Date into Microsoft Access

Reply
  #1 (permalink)  
Old 10-01-04, 05:58 AM
gop373 gop373 is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Insert Date into Microsoft Access

I want to insert date into table name AAA. Table AAA coloum name dat the type of this column date/time m/d/yyyy. Ex. 10/1/2004

dim todaysDate,t,testdate
todaysDate=now()
testdate=FormatDateTime(todaysDate,2)
sql="insert into AAA(dat,price) values('"&testdate&"',"&cp1&")"

But when I check in table AAA the date is like this 1/10/2004 . The form that i want to insert is m/d/yyyy

One more thing. I don't want to use Cstr() because I need to compare date.

sql="select Max(price) as maxprice from Microsoft where dat=date()"

Last edited by gop373; 10-01-04 at 06:15 AM.
Reply With Quote
  #2 (permalink)  
Old 10-01-04, 08:54 AM
brayton brayton is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
just use date as


strDate = date

you try that yet?
Reply With Quote
  #3 (permalink)  
Old 10-01-04, 04:43 PM
Naresh Rohra Naresh Rohra is offline
Newbie Coder
 
Join Date: Jun 2004
Location: India
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Check Regional settings.

Check regional settings Date format. It should be mm/dd/yyy. It will control how date is displayed in MS Access.


Cheers.
Naresh.
__________________
My Home Page
Reply With Quote
  #4 (permalink)  
Old 10-02-04, 04:19 AM
gop373 gop373 is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, I already try to use strDate = date but that will convert date into string. And the problem is if I convert date into string I can compare date. It doesn't work well if convert date into string.
Reply With Quote
  #5 (permalink)  
Old 10-05-04, 09:26 AM
hellind2 hellind2 is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
If i am not wrong, the date format in your database is the 'regional setting' in your access database.

Once you retreive from you database, it is left to the script to manipulate it.
Reply With Quote
  #6 (permalink)  
Old 10-05-04, 10:57 AM
Franzioz Franzioz is offline
New Member
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Try this

Dim testdate

testdate = month(now()) &"/"& day(now()) &"/"& year(now())
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM
AccessDB.Info - Microsoft Access Site - Please Critique cosmos75 Website Reviews 11 06-08-04 08:09 PM
Access Database Date Problem emvanlill Windows .NET Programming 2 05-10-04 03:06 AM
MySQL table problem perleo PHP 9 12-16-03 01:16 PM
Date From Access 2000 Database Kaikki ASP 4 09-25-03 06:04 PM


All times are GMT -5. The time now is 03:06 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.