473,569 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change date according to time: Minus week-ends

Dököll
2,364 Recognized Expert Top Contributor
Greetings and salutations!

Ran a quick search here a found this: http://www.thescripts.com/forum/thre...inus+date.html Though it is very helpful when dealing with dates alone, I cannot tweak it to fit my demands.

I decided to try it in query:

The idea is to look two fields through a query (TodayTime and TodayDate), and change my dates to previous date, according to Time, and the time must be specific, > than 3:30 PM, while minusing the week-ends:

The query is not ready yet, will post in a bit.

Any help you can provide is surely appreciated:-)
Sep 24 '07 #1
7 1706
Dököll
2,364 Recognized Expert Top Contributor
Greetings and salutations!

Ran a quick search here a found this: http://www.thescripts.com/forum/thre...inus+date.html Though it is very helpful when dealing with dates alone, I cannot tweak it to fit my demands.

I decided to try it in query:

The idea is to look two fields through a query (TodayTime and TodayDate), and change my dates to previous date, according to Time, and the time must be specific, > than 3:30 PM, while minusing the week-ends:

The query is not ready yet, will post in a bit.

Any help you can provide is surely appreciated:-)
Now the query works just fine:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT ThisTableData.TodayDate, ThisTableData.TodayTime, DateAdd("d",-1,[ThisTableData.TodayTime]) AS DateOO
  3. FROM ThisTableData
  4. WHERE (((ThisTableData.TodayDate) Between #9/1/2007# And Now()) AND ((ThisTableData.TodayTime) Not Like "*AM*") AND ((DateAdd("d",-1,[ThisTableData.TodayTime])) Not Like "*12:*"));
  5.  
  6.  
TodayTime hold the time I need to fool around with, as mentioned above. My problem now is figuring out how to disregard 12 Noon Through 3:29 PM hours:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Not Like "*12:*"
  3.  
  4.  
Works, but when I plug in:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Not Like "*1:*"
  3.  
  4.  
Access thinks I mean 1:01:00 PM

What do you make of it?
Sep 24 '07 #2
Scott Price
1,384 Recognized Expert Top Contributor
What happens if you use 24 hour time instead of the 12 hour variety? i.e. 13:00 instead of 1:00pm...

Regards,
Scott
Sep 25 '07 #3
Dököll
2,364 Recognized Expert Top Contributor
Thanks much, Scott, I did not think of of that:-)

Have a good week!
Sep 25 '07 #4
Dököll
2,364 Recognized Expert Top Contributor
What happens if you use 24 hour time instead of the 12 hour variety? i.e. 13:00 instead of 1:00pm...

Regards,
Scott
Actually, Scott, I almost forgot my manners. You are recent Mod, correct! I do not believe to have welcomed you, Welcome!!!

Dököll
Sep 25 '07 #5
FishVal
2,653 Recognized Expert Specialist
Hi, Dokol.

So, why not to use Hour() function?
Sep 25 '07 #6
Scott Price
1,384 Recognized Expert Top Contributor
Actually, Scott, I almost forgot my manners. You are recent Mod, correct! I do not believe to have welcomed you, Welcome!!!

Dököll
Thanks, Dokoll! I'm getting adjusted to this new level of responsibility :-)

The 24 hour format will not work, obviously, if you are comparing against existing data that is contained in 12 hour format. In which case, using the Hour() function may be the best way to go.

Regards,
Scott
Sep 25 '07 #7
Dököll
2,364 Recognized Expert Top Contributor

Hi, Dokol.

So, why not to use Hour() function?
Great minds think alike. I was coming over to report it not working. In I attempted to convert to 13:00 it did not like. I also still have Now(), rather than Time(), in my table for the TodayTime field. I must have kept it there because it gave me the time anyway through the form. Will try your examples:-)

take care good buddies, and thanks!
Sep 25 '07 #8

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

Similar topics

2
5204
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much appreciated. TIA
0
1403
by: David | last post by:
Hi, I have an ASP app running via our MySQL server. On one of my .asp pages I have an sql string as follows: .......WHERE ShipDate >= curdate()-7 This worked great up until the end of yesterday pulling up all records from last week (Todays date minus 7 days). Now we are in October, for some reason, this has stopped working, so my page...
6
9824
by: Luis | last post by:
I've adapted the following code so that it prints the date in DD/MM/YYYY format. However it prints the incorrect date! If todays date is 01/01/2003 it prints 03/01/2003 - 3 days out! What have I done wrong? <script language="Javascript"> aCalendar = new Date(); CalendarDay = aCalendar.getDay(); CalendarMonth = aCalendar.getMonth();
7
3971
by: Mick White | last post by:
According to the Safari browser the world began on "Fri Dec 13 1901 15:45:52 GMT-0500", but I need to be able to get around this limitation. I am interested in dates from 1500 to 1901, as far as I can determine, there are 14 possible calendar variations. Year starts on Sun, Mon..... Leap year starts on Sun, Mon.. I can label these...
4
2599
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family...
1
6120
by: Wayne | last post by:
Hi all I'm trying to calculate the number of days (or workdays) between 2 given dates that do not include weekend days or public holidays (public holidays are user defined from a dbase, have a start date & an end date & may span a weekend) If a start date (workday) & an end date (workday) are on the same day then the number of workdays...
11
10555
by: shsandeep | last post by:
I used the following query to retrieve the date in dd-mon-yyyy format. db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' || RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' || RTRIM(CHAR(YEAR(COVG_TYP_STRT_DT))) FROM twd_coverage_type 1...
44
10154
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
4
2324
by: CDMAPoster | last post by:
In: http://groups.google.com/group/comp.databases.ms-access/msg/f06bd4c45037ef29 Lyle wrote: :Terry Kreft wrote: : :>Suck it and See? :
5
1591
by: Amzul | last post by:
hello all i am breaking my head over this and there isnt any good solution that i have saw til now, my problam is that i want to tell the date of a sertin day what was choosen <select id="7_day" name ="7days"> <option value="0">Sunday</option> <option value="1">Monday</option> <option value="2">Tuesday</option> <option...
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
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...
0
5219
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...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
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...

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.