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

Compare user entered date with database date time

250 100+
I want to compare user entered date with data base datetime value. Database value in datetime type and first i want to extract date part and then compare with user entered value. This is my query. Could someone tell me what is wrong with it?

[PHP]SELECT * FROM db WHERE Date = SELECT CAST(Date AS DATE) AS dateonly FROM db[/PHP]
Apr 18 '08 #1
4 4143
Markus
6,050 Expert 4TB
I want to compare user entered date with data base datetime value. Database value in datetime type and first i want to extract date part and then compare with user entered value. This is my query. Could someone tell me what is wrong with it?

[PHP]SELECT * FROM db WHERE Date = SELECT CAST(Date AS DATE) AS dateonly FROM db[/PHP]
I'd recommened asking in the mysql forum!
Apr 18 '08 #2
ronverdonk
4,258 Expert 4TB
This is not a PHP question, but a MySql one. I will move this thread to the MySQL forum.

moderator
Apr 18 '08 #3
ronverdonk
4,258 Expert 4TB
You are triple posting! You opened a MySQL thread in the PHP and in two in the MySQL forum. And this question has nothing to do with PHP.

warning: do not double/triple post, especially not in a non-question releated forum. Not complying on this with the Posting Guidelines on this will result in a ban from this site next time.

moderator
Apr 18 '08 #4
ronverdonk
4,258 Expert 4TB
What is the user-entered value in this query?
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM db WHERE Date = SELECT CAST(Date AS DATE) AS dateonly FROM db
Ronald
Apr 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
2
by: Renie83 | last post by:
Hi I really am going crazy! I'm using VBScript, ASP, and SQL My page reminds me of a shopping cart but looking at shopping cart examples has not helped! What I have is a page that brings in...
9
by: Rich | last post by:
Thanks for the Help in my previous post. I've been working on this and it's almost what I want. I want to obtain the user's current age by comparing their date of birth (user inputs) to the...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
0
by: atif | last post by:
how to compare two dates n how to fill the text box with date only. i tried to do it like date.now() but the textbox is filled with date n time. Second questoin is i hav a table like "user" in the...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
2
by: deancarstens | last post by:
Hi, I'm a novice with VB and I've written this pretty simple script, but for the life of me, I can't get the last bit of the script to work. It should compare the value entered by the user...
2
tuxalot
by: tuxalot | last post by:
I have a textbox, on with a record source . FrmMain is a tabbed form showing injury data for a given EmployeesID. I have a textbox, on a subform . with as the record source. is entered by a...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.