473,320 Members | 2,180 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,320 software developers and data experts.

int to char ... date problem

I know that you would use cInt(n) to convert a string to an integer.
How do you convert an integer to a string?
I have a varChar field in a database that I am inserting a date field
(needs to be a char field).
The date is formatted like so:
y = year(now())
m = month(now())
d = day(now())
vNow = Y & "-" & M & "-" & D
To me this looks like it should come up with
vNow = 2004-6-25
But instead it is actually doing the math and coming up with
vNow = 1973
Jul 19 '05 #1
2 3190
Robin wrote:
I have a varChar field in a database that I am inserting a date
field (needs to be a char field).


This makes no sense to me whatsoever. On one hand, it sounds as though you
want to convert a VARCHAR to a CHAR. That has nothing at all to do with ASP.
Beyond that, it is not clear if you are inserting a date (the abstract
notion of a date, that is) into a VARCHAR, or attempting to convert a
VARCHAR to a DATE.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #2
> I know that you would use cInt(n) to convert a string to an integer.
How do you convert an integer to a string?
CStr() ?
I have a varChar field in a database that I am inserting a date field
What? You're inserting a date value into a VARCHAR column? WHY?

Is this Access, SQL Server, FoxPro, MySQL, ...? What version?
But instead it is actually doing the math and coming up with
vNow = 1973


Can you show the actual code that causes this to happen?

--
http://www.aspfaq.com/
(Reverse address to reply.)

Jul 19 '05 #3

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

Similar topics

1
by: Loi Tan Vo | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be imported, I want to convert the date column to date type. For...
2
by: Connie Sawyer | last post by:
I am trying to run the following query: ALTER TABLE dnb_profile ALTER COLUMN datetime and I keep getting the following error: Server: Msg 242, Level 16, State 3, Line 1 The conversion of...
12
by: LongBow | last post by:
Hello all, From doing a google serach in the newsgroups I found out that a string can't be returned from a function, but using a char* I should be able to do it. I have spent most of the day...
7
by: tano | last post by:
Hello, I have to insert a char in the middle of a string, I have written two functions but I don't know what is the better? The problem is: if I use malloc() I copy all the string with the new...
7
by: GRoll35 | last post by:
This is 1 source page of a project im working on. i just have this one error. i'll show the error then show the code.. i'll point out the line that it doesn't like. if anyone has any ideas or...
12
by: GRoll35 | last post by:
I get 4 of those errors. in the same spot. I'll show my parent class, child class, and my driver. All that is suppose to happen is the user enters data and it uses parent/child class to display...
0
by: coolvivek33 | last post by:
hi i am facing a strange problem i am trying to build report using sql server 2005 and microsoft visual studio2005 now it is in requirement that i should seperate date from time.I have done that...
1
by: Roobmeister | last post by:
I am trying to return either a date in MMDDYYYY format, or a blank fixed width of 8 as part of a giant concatenation. For some reason, I am stuck on this point: ...
4
by: MimiMi | last post by:
I'm trying to put together a http response header. It seems to work, except for that I don't get the data string added correctly! I wouldn't be surprised if my problems have something to do with...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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: 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...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...

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.