473,791 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filter expression with date AND TIME

Hello everybody

I using an dataview rowfilter expression to filter some record from one
dataset, is I only working with the date portion no problem, but how do I
use the date and the time for filter some records ?
the code that I have is like this one:

crit1 = "fecha >= #"+dtpDesde.Val ue.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Val ue.ToString("MM/DD/YYYY")+"#";
filtro = crit1 + " AND " + crit2 ;

my datetime picker dtpDesde and dtpHasta have the time in there format and
the field fecha is datetime and I want to filter by time to.

Please, any help ?

MajorTom
Nov 16 '05 #1
2 8228
If the Value property of the controls is a datetime variable then just add
the time to the format string you already have. If the time is stored
separately then create a TimeSpan instance from the time value and add it to
the date, and then format it all together.

--Bob

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:Ok******** ******@tk2msftn gp13.phx.gbl...
Hello everybody

I using an dataview rowfilter expression to filter some record from one
dataset, is I only working with the date portion no problem, but how do I
use the date and the time for filter some records ?
the code that I have is like this one:

crit1 = "fecha >= #"+dtpDesde.Val ue.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Val ue.ToString("MM/DD/YYYY")+"#";
filtro = crit1 + " AND " + crit2 ;

my datetime picker dtpDesde and dtpHasta have the time in there format and
the field fecha is datetime and I want to filter by time to.

Please, any help ?

MajorTom

Nov 16 '05 #2
thank for your help

like this:
....ToString("M M/dd/yyyy HH:mm")+"#";

I going to test it

Thanks againg

MajorTom

"Bob Grommes" <bo*@bobgrommes .com> wrote in message
news:#r******** ******@TK2MSFTN GP11.phx.gbl...
If the Value property of the controls is a datetime variable then just add
the time to the format string you already have. If the time is stored
separately then create a TimeSpan instance from the time value and add it to the date, and then format it all together.

--Bob

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:Ok******** ******@tk2msftn gp13.phx.gbl...
Hello everybody

I using an dataview rowfilter expression to filter some record from one
dataset, is I only working with the date portion no problem, but how do I use the date and the time for filter some records ?
the code that I have is like this one:

crit1 = "fecha >= #"+dtpDesde.Val ue.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Val ue.ToString("MM/DD/YYYY")+"#";
filtro = crit1 + " AND " + crit2 ;

my datetime picker dtpDesde and dtpHasta have the time in there format and the field fecha is datetime and I want to filter by time to.

Please, any help ?

MajorTom


Nov 16 '05 #3

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

Similar topics

0
6476
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
4
5293
by: S. van Beek | last post by:
Dear reader, By a Date field with Now() as default value the content of the field is date plus time. As I need a filter in a query on date only (excluding time) I invented the following solution:
6
17924
by: Tony Miller | last post by:
All I have an aggregate query using the function Month & Year on a datereceived field ie: TheYear: Year() TheMonth: Month() These are the group by fields to give me a Count on another field by year & month When I try to place a date filter 'Between x And y ' on an expression field
6
3298
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a PC with let's say ddmmyyyy windows date format and the client has mmddyyyy. when the filter expression send is "Date < #31/01/2003#", it will fail on
4
2150
by: Takeadoe | last post by:
I recently asked the group for help on converting 3 numeric variables to a new date variable. The DATESERIAL function below worked perfectly! My question now relates to problems with this new variable when I try to filter either by form or selection. If I type 10/20/2005, just as you see it, with no quotes or other punctuation, in the testHarvestDate field I get the following error message: DATATYPE MISMATCH IN CRITERIA EXPRESSION and...
6
8366
by: fonzie | last post by:
Is there any way to include two unbound text boxes (for a start date and end date) to a filter-by-form? The users may want to filter by several different fields and they may want to include a date range search on the one date field. Instead of having the users type in
2
5545
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by Form" in order to search for records based on this form, I would like to be able to enter a value in this "days" control so that I can filter records on the form based on this calculated interval (i.e., i want to search for records specifically where...
5
4020
by: DAHMB | last post by:
Hi all, Using Access 2007 I have a report called Sunday School Attendance based on a Query called qryAttendance the query is as follows: SELECT tblSundaySchoolAttendance.StudentID, tblSundaySchoolAttendance.AttendanceDate, . FROM tblSundaySchoolAttendance INNER JOIN ON tblSundaySchoolAttendance.StudentID=.StudentID;
2
12616
by: Duggi | last post by:
Hi I have a dataview dv, in which one of the column is a date time column. I would like to apply filter on this column. The filter should be some thing like "All the rows that has the date time between DATE1 and DATE2".
0
9515
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,...
0
10427
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10155
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
9029
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...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
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
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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
3
2916
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.