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

Very strange date problem

Hi everybody,

When I use the following to add a record to a database

rs.addNew
rs("ReplyTo") = ReplyToID
rs("mID") = Request.cookies("IsLogged")("mid")
rs("Topic") = Topic
rs("Message") = Message
rs("DateTime") = Now
rs("IP") = Request.ServerVariables("REMOTE_HOST")
rs.Update

It adds the correct NOW date in rs("DateTime") today is 12-08-2003

But when I use the following to add the NOW date to a diferent table

db.execute("Update tblTopic set LastDate = '" & Now & "', Replies = Replies
+ 1 where PostID = " & ReplyToID)

It adds the NOW date as 08-12-03

both rows have the same settings, DATE/TIME with format GENERAL DATE

Any suggestions ?

Thanx,

Willem-Jan Selen
Jul 19 '05 #1
5 1728
Willem-Jan Selen wrote:
Hi everybody,

When I use the following to add a record to a database

What database???
Jul 19 '05 #2
Access Db
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Willem-Jan Selen wrote:
Hi everybody,

When I use the following to add a record to a database

What database???

Jul 19 '05 #3
But how do I format the NOW ?


"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Format your dates as YYYYMMDD or YYYY-MM-DD before sending to the database. Then there is no confusion.

"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060687080.620549@cache2...
Hi everybody,

When I use the following to add a record to a database

rs.addNew
rs("ReplyTo") = ReplyToID
rs("mID") = Request.cookies("IsLogged")("mid")
rs("Topic") = Topic
rs("Message") = Message
rs("DateTime") = Now
rs("IP") = Request.ServerVariables("REMOTE_HOST")
rs.Update

It adds the correct NOW date in rs("DateTime") today is 12-08-2003

But when I use the following to add the NOW date to a diferent table

db.execute("Update tblTopic set LastDate = '" & Now & "', Replies =

Replies
+ 1 where PostID = " & ReplyToID)

It adds the NOW date as 08-12-03

both rows have the same settings, DATE/TIME with format GENERAL DATE

Any suggestions ?

Thanx,

Willem-Jan Selen


Jul 19 '05 #4
> But how do I format the NOW ?

http://www.aspfaq.com/2313
Jul 19 '05 #5
Willem-Jan Selen wrote:
Access Db
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Willem-Jan Selen wrote:
Hi everybody,

When I use the following to add a record to a database

What database???

Then you need to use either US format MM/DD/YYYY (per Access help) or
YYYY-MM-DD format (recommended). Others have shown you how to do the
formatting. However, you do not have to pass Now() to the query: you can let
it be calculated in the query:

db.execute("Update tblTopic set LastDate = Now()")

If you want to pass it to the query, then it will be passed as a date
literal, and will need to be delimited with hash marks (#):

db.execute("Update tblTopic set LastDate = #" & Now & #"

But, again, let the query calculate it.

Bob Barrows
Jul 19 '05 #6

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

Similar topics

3
by: Jim Irvine | last post by:
I have a small database made up of 2 tables. I have a report that is driven from a query. On the report are a couple of fields linked to memo boxes in the table. Everytime I run the report I get...
6
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
2
by: Tariq Ahmad | last post by:
hi, i am having big issues in deploying my asp.net web application to our web server. dates do not behave the same as on my development machine yet the web.config files are the same and both...
3
by: Jim in Arizona | last post by:
I'm going insane! I don't know if it's just that the .net 2.0 framework is buggy or if it really is my code. This is pretty hard to explain since I can't even begin to nail down why this is...
10
by: Trapulo | last post by:
Why Now.Date.Subtract(New Date(2000, 1, 1)).Days returns 731529?? It is a too big value a think! I aspect something as 1030-1100....
2
by: peter | last post by:
Hi, I have very strange situation but first description ;) I have: 1) project in VB.NET, in this f.e. 1 function: Public Function Login(ByVal UserName As String, ByVal UserPassword As...
1
by: Dan2kx | last post by:
Hello (again) i have a rather strange problem to tackle i am still doing the holiday database (for those who have helped me before) and now need (which means i have to rethink everything) to...
3
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.