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

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.Value.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Value.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 8207
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.********@NOverizon.net.do> wrote in message
news:Ok**************@tk2msftngp13.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.Value.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Value.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("MM/dd/yyyy HH:mm")+"#";

I going to test it

Thanks againg

MajorTom

"Bob Grommes" <bo*@bobgrommes.com> wrote in message
news:#r**************@TK2MSFTNGP11.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.********@NOverizon.net.do> wrote in message
news:Ok**************@tk2msftngp13.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.Value.ToString("MM/DD/YYYY")+"#";
crit2 = "fecha <= #"+dtpHasta.Value.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
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...
4
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...
6
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...
6
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...
4
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...
6
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...
2
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...
5
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,...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.