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

how to ignore time and get only date in a query?

nirmalsingh
218 100+
in a datetime field, i need only date and not time. for eg: 12/06/2006 12:12:00
i need the result as 12/12/2006. how should i write query to get this resultant?
Jun 20 '07 #1
3 13545
in a datetime field, i need only date and not time. for eg: 12/06/2006 12:12:00
i need the result as 12/12/2006. how should i write query to get this resultant?
you can use datepart to retrive the required part of the date from datetime
Jun 20 '07 #2
siva538
44
in a datetime field, i need only date and not time. for eg: 12/06/2006 12:12:00
i need the result as 12/12/2006. how should i write query to get this resultant?
Try this

Expand|Select|Wrap|Line Numbers
  1. SELECT CONVERT(VARCHAR(10),GETDATE(),101)
  2.  
Regds,
Sivakumar
Jun 20 '07 #3
mandy1
7
in a datetime field, i need only date and not time. for eg: 12/06/2006 12:12:00
i need the result as 12/12/2006. how should i write query to get this resultant?

Hello to every one. Myself Mandeep and new to all of u.

u can use following format to extract date, or date+time
suppose your date and time are stored in DTime field. then u can use following.

Format(DTime, "General Date") Example date+time
Format(DTime, "Long Date") Example sunday,december 02,2006
Format(DTime, "Medium Date") Example same as long date
Format(DTime, "Short Date") Example 12/02/2006

Remember: DTime is your field in which date and time is stored together.

Real Example

Select format(DTime, "Short date") AS Date_Result From XYZ;

Mandy(Mandeep)
Jun 21 '07 #4

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

Similar topics

1
by: compusup3000 | last post by:
Hi, I have an orders database and I need to be able to write a query that groups sales by: 1. Date 2. Time of day (both am and pm) I currently have a date/time field named "Submitted" that...
5
by: Javier | last post by:
I have a field type Date/Time that automatically defaults to Now(). I'm having a problem writing a query that will retrieve all the records for a specific date the user to enters when prompted. I...
4
by: Mark Reed | last post by:
Hi all, I have a query (query1) which shows scan date, scan time & operator. One scan = 1 record. What I want to do is create a report based on query 2 from query1 which shows all the scans AND...
4
by: Polly | last post by:
I had a macro that ran a parameter query and created and opened an Excel file with the system date as part of the file name, but I had to change the file name by hand. So I converted the macro to...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
8
by: sixdeuce62 | last post by:
Hello, I am using Access 2002. I have read through 20 plus posts on here and I am still having trouble. My table consists of the following fields: Date Client ID
3
by: tdes42 | last post by:
I believe I am looking for some form of Join Query, but my understanding of Access logic and my logic do not yet click entirely…. I have a table of ocean buoy data, taken every hour over many...
2
theGeek
by: theGeek | last post by:
I always wonder which one of join or subquery should I be using to solve a particuar problem so that I get the correct result set in minimum time. It usually happens that I can write a query quickly...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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:
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...
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...

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.