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

Date type in ASP/Javascript/SQL

How do I handle date methods like getDate() on values I get from a
recordset? Example:

rs.Source= "Select SomeDateField From SomeTable"
....

1)
Response.write(rs.Fields.Item("SomeDateField"));
output: 11/16/2006

2)
Response.write(String(rs.Fields.Item("SomeDateFiel d")));
output: Thu Nov 16 00:00:00 EST 2006

Since there's a difference I would expect rs.Fields.Item("SomeDateField")
is a date type. But I cannot apply date methods:

3)
Response.write((rs.Fields.Item("SomeDateField").Va lue).getDate());
error: 'rs.Fields.Item(...).Value' is null or not an object

4)
Response.write((rs.Fields.Item("SomeDateField")).g etDate());
error: Object doesn't support this property or method

5)
Response.write(CDate(rs.Fields.Item("SomeDateField ")).getDate());
error: Object expected
Dec 6 '06 #1
1 3243
This link answers many date related questions.

http://www.aspfaq.com/search.asp?q=f...Days=0&order=1
--
Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com

The views expressed are my own (as annoying as they are), and not those of
my employer or anyone else associated with me.
-----------------------------------------------------

"Jan Paul van de Berg" <ja**@ulvandebe.rgwrote in message
news:gk****************************@40tude.net...
How do I handle date methods like getDate() on values I get from a
recordset? Example:

rs.Source= "Select SomeDateField From SomeTable"
...

1)
Response.write(rs.Fields.Item("SomeDateField"));
output: 11/16/2006

2)
Response.write(String(rs.Fields.Item("SomeDateFiel d")));
output: Thu Nov 16 00:00:00 EST 2006

Since there's a difference I would expect rs.Fields.Item("SomeDateField")
is a date type. But I cannot apply date methods:

3)
Response.write((rs.Fields.Item("SomeDateField").Va lue).getDate());
error: 'rs.Fields.Item(...).Value' is null or not an object

4)
Response.write((rs.Fields.Item("SomeDateField")).g etDate());
error: Object doesn't support this property or method

5)
Response.write(CDate(rs.Fields.Item("SomeDateField ")).getDate());
error: Object expected

Dec 7 '06 #2

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

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: m | last post by:
hi all, got an interesting problem: im working with purchase orders and in detail line i have a date field. so for example: header line: PO code: X123 PO value: ...
14
by: Steve Wright | last post by:
I am trying to validate if an entry on a form is a date. I have adapted code I found here http://www.codingforums.com/archive/index.php/t-14325 as below but I can't seem the get the results that I...
8
by: dlx_son | last post by:
Here is the code so far <form name="thisform"> <h3>Enter time to add to or subtract from:</h3> (If not entered, current time will be used)<br> Day: <input name="d1" alt="Day of month"...
38
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } ...
4
by: Kun | last post by:
i have a form which takes in inputs for a mysql query. one of the inputs is 'date'. normally, a user has to manually enter a date, but i am wondering if there is a way to create a button which...
9
by: mistral | last post by:
Need help to remove list of days from date script. Need format "June 07, 2006" <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Get today's current date. var now = new Date();
15
by: Cerebral Believer | last post by:
Hi all, I am a newbie to JavaScript and am just trying to get a script going that will write the ful date and time to each webpage as it is viewed. Can anyone point out what mistakes there are...
6
by: ruraldev | last post by:
I have been trying my best to display a chosen date as dd-mm-yyyy but insert it into the mysql database as yyyy-mm-dd, I know it must be simple but no matter what I try I can't get it to work. At...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
1
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.