All community
This category
This board
Knowledge base
Users
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forÂ
ShowÂ
 onlyÂ
|
Search instead forÂ
Did you mean:Â
Exit
Global community
Language:
Deutsch
English
Español
Français
Português
日本語コミュニティ
Dedicated community for Japanese speakers
í•œêµ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Sign In
Home
ColdFusion
Discussions
Get week start and end dates
Home
ColdFusion
Discussions
Get week start and end dates
0
Upvote
Get week start and end dates
matthisco
Explorer
,
/t5/coldfusion-discussions/get-week-start-and-end-dates/td-p/138776
Jan 21, 2009
Jan 21, 2009
Copy link to clipboard
Copied
I'm currently coding a calendar where I want to diplay all event for the current week.
Can anyone tell me how to get the dates to use in the query?
Thanks
Views
421
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
4 Replies
4
Jump to latest reply
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/get-week-start-and-end-dates/m-p/138777#M12836
Jan 21, 2009
Jan 21, 2009
Copy link to clipboard
Copied
For weeks starting on Sunday.
Offset = (DayOfWeek(Now()) - 1) * -1;
Date1 = dateadd("d", offset, now());
Date2 = dateadd("d", 7, Date1);
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
matthisco
AUTHOR
Explorer
,
/t5/coldfusion-discussions/get-week-start-and-end-dates/m-p/138778#M12837
Jan 21, 2009
Jan 21, 2009
Copy link to clipboard
Copied
Thanks for your reply.
That gives me
Sunday, January 18, 2009
Sunday, February 1, 2009
Im looking for:
Sunday, January 18, 2009
Sunday, January 25, 2009
Thanks again
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/get-week-start-and-end-dates/m-p/138779#M12838
Jan 21, 2009
Jan 21, 2009
Copy link to clipboard
Copied
When I run this:
<cfscript>
Offset = (DayOfWeek(Now()) - 1) * -1;
Date1 = dateadd("d", offset, now());
Date2 = dateadd("d", 7, Date1);
</cfscript>
<cfdump var="#date1# and #date2#">
I get this:
{ts '2009-01-18 10:58:34'} and {ts '2009-01-25 10:58:34'}
Looks like I should have only added 6 days for date2, but that's minor. How did you manage to get 2009-02-01?
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
matthisco
AUTHOR
Explorer
,
/t5/coldfusion-discussions/get-week-start-and-end-dates/m-p/138780#M12839
Jan 22, 2009
Jan 22, 2009
Copy link to clipboard
Copied
LATEST
Thanks Dan!
It works great, I dunno how I go those dates in the first instance
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Post Reply
Preview
Exit Preview
never-displayed
You must be signed in to add attachments
never-displayed
Â
Resources
Documentation
ColdFusion User Guide