473,804 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3204
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
67392
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 ex. the text file look like Name date Smith 20003112
2
9335
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 a char data type to a datetime data type resulted in an out-of-range datetime value.
12
2756
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 trying to get this to work, but been unable to solve my mistake. What the function should return is a file name used for creating logs files. It will look something like JN122345.log
7
14796
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 char in the middle every time, with realloc() the part of the string before the position where the char has to be inserted is not changed if realloc returns the same pointer is passed, but if not the string is copied at all the first time, and then...
7
5338
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 advise that would be great. thank you very much! (42): error C2664: 'std::basic_istream<_Elem,_Traits>::_Myt &std::basic_istream<_Elem,_Traits>::getline(_Elem *,std::streamsize)' : cannot convert parameter 1 from 'char ' to 'char *' with
12
10093
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 it. here is the 4 errors. c:\C++\Ch15\Employee.h(29): error C2440: '=' : cannot convert from 'char ' to 'char '
0
1673
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 using visual studio with following code on one of the dataset values with the help of following code SELECT Convert(varchar, Deliverydate, 103) as displayValue FROM TimePeriodOrderDeliveryDate.This only dispalys the date part from the ate time...
1
7079
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: ISNULL(REPLACE(convert(char(8),mydate,101),'/',''),CONVERT(char(8),'')) "mydate" is a field of type datetime, but can sometimes be null. The problem I am running into is that whether I write this as an "ISNULL" or a CASE statement, it doesn't seem to be able to return a...
4
3097
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 my still existing confusion over arrays and pointers in C since I'm still a newbie, but anyhow, here's the code: #include <time.h> #include <stdio.h> #define WEBBUF_SIZE 32768
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.