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

Date manipulation

I need to find a way to write a query that will return the date of the
Friday of four weeks ago. So, if I use today's date (7/30), I should
be returning 7/6 as 4 weeks ago on Friday. Any help is appreciated.

Jul 30 '07 #1
2 2095
Here's some links you might find useful:
A plethora of date functions
http://www.pacificdb.com.au/MVP/Code/Dates.htm
Functions for calculating and for displaying Date/Time values in Access
http://support.microsoft.com/default...en-us%3B210604

Chris wrote:
>I need to find a way to write a query that will return the date of the
Friday of four weeks ago. So, if I use today's date (7/30), I should
be returning 7/6 as 4 weeks ago on Friday. Any help is appreciated.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 30 '07 #2
Chris <co*****@gmail.comwrote in
news:11**********************@x35g2000prf.googlegr oups.com:
I need to find a way to write a query that will return the
date of the Friday of four weeks ago. So, if I use today's
date (7/30), I should be returning 7/6 as 4 weeks ago on
Friday. Any help is appreciated.

Access has powerful date mathematics functions.

DateAdd() does what it says, adds a number of periods e.g. days,
weeks months, to a date, or substracts them
Weekday() returns a number from 1 to 7, from Sunday to Saturday.

First we need next Friday:
Dateadd("d", 7- weekday(date(),vbSaturday ),date())

Then we subtract 4 or 5 weeks:(not sure if you mean 4 weeks ago
from last or next friday.

DateAdd("ww",-4, Dateadd("d", 7- weekday(date(),vbSaturday
),date()))

Paste that in the field row of the query designer, change the
expr1: to a meaningful name, and test it.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 1 '07 #3

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

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
16
by: jason | last post by:
I'm tearing out my hair here: ACCESS 2000: When I attempt to overwrite a date in my date field with a new user selected valid date eg: 05/23/99 my date field changes to the TIME I updated the...
7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
5
by: John Kiernan | last post by:
Hey JavaScript gurus! Here's a weird one: If I check (with an alert) this line: vStrDate2 = vDate.toLocaleString(); I get: Saturday, August 14, 2004 7:57:30 PM (as I should) but this...
26
by: sgershon | last post by:
Hi. I know this is should be a simple question. I know server-side web-programming, and never needed to use client-side scripting... until now :) I have done so far a little number of scripts...
5
by: WindAndWaves | last post by:
Hi Gurus This is a cry for help to all of you. I am looking for some sort of plug-in/active X/code/link to outlook/what have you, which I can add to my MS Access database for my users to...
1
by: Graham Feeley | last post by:
I have a date field named rcdate it is a general date eg: 12/08/2006 3:30:00 PM 12/08/2006 3:00:00 PM I used to update another empty field named rdate with the with using in a update query "...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
2
by: Billy | last post by:
This string is supposed to provide all records from an MDB database that match the courier and date specified in the query. I Response.Write the query and I get a date as 1/27/2007. The date...
3
by: GorseFox | last post by:
Forgive me. I am new to PHP and am a little confused by date manipulation and would appreciate some guidance. I have a string containing a date which has been parsed from and RSS feed. This looks...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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...
0
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...
0
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...

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.