date format , time contraints

imfarhan

Board Regular
Joined
Jan 29, 2010
Messages
125
Office Version
  1. 2016
Platform
  1. Windows
<TABLE cellSpacing=0 bgColor=#ffffff border=1><CAPTION>Query8</CAPTION><THEAD><TR><TH borderColor=#000000 bgColor=#c0c0c0>Ename</TH><TH borderColor=#000000 bgColor=#c0c0c0>Edate</TH><TH borderColor=#000000 bgColor=#c0c0c0>Rdate</TH><TH borderColor=#000000 bgColor=#c0c0c0>Expr1003</TH></TR></THEAD><TBODY><TR vAlign=top><TD borderColor=#c0c0c0>Imran</TD><TD borderColor=#c0c0c0 align=right>23/01/2011 00:01:01</TD><TD borderColor=#c0c0c0 align=right>23/01/2011 23:20:01</TD><TD borderColor=#c0c0c0 align=right>23/08/2011 10:46:12</TD></TR></TBODY><TFOOT></TFOOT></TABLE>

I have got one of the above value in entiere table
I'm only interested in the one Edate and Rdate are "now()-1" not before and after.

I have used the following conditions but no Success:

Code:
where edate >=  (now()-1 & 00:01:01) and edate <= edate(now()-1 & 23:59:59)
 
OR
where edate between edate (now-1 & 00:01:01) and edate (now()-1 & 23:59:59)
OR
 
Or where edate >= format (now()-1 00:00:01,"dd/mm/yyy hh:mm:ss")
    and  edate <= format (now()-1 23:59:59,"dd/mm/yyy hh:mm:ss")
 
and try the above with between but nothing coming up don't know why?
Questions ,
which one is better if you want to use time contraint "BETWEEN" or ">=" "<=" ?
In my actual query , I'm using control paramters i.e. PARAM1 and PARAM2.
The param should brings only date value as shown below but would like to add time value
Code:
And (StWDate)<=[Param2] 
 
How can I add time contraint value in above control Param2  23:59:59 ,  ([Param2] & 23:59:59) ?
the above Param2 value after running will be look like as follow on Design er view:
 
[QUOTE]
>=#15/08/2011# And <=#22/08/2011#
[/QUOTE]
 
How can I add time value as its missing some rows in actual table because of time value i think:
can I try like 
And (StWDate)<=[Param2] [COLOR=red]& 23:59:59 but how?[/COLOR]

Many thanks
Farhan
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
YEs, i have put the wrong Month value should be "08" not "01"
i'm checking again on live DB
 
Upvote 0
What exactly are you trying to do/find?

Here's a link with various Date and Time calculation examples

http://support.microsoft.com/kb/210604

Also, here's an example I just tried

?now() & " " & Now () - 1
8/24/2011 9:53:58 AM 8/23/2011 9:53:58 AM
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top