Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Report Design
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Report Design
Topic: First Monday in Week
Author
Message
roxaneamanda
Newbie
Joined: 10 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 23
Topic: First Monday in Week
Posted: 09 Feb 2010 at 7:59am
I have a date field and I would like a formula to display the week commencing date for the week that that date falls into eg
Date Created Week Commencing
10/02/10 9:00am 08/02/10
IP Logged
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 09 Feb 2010 at 8:14am
if you can convert the data to MM/dd/yyyy instead of dd/MM/yyyy format you can use:
dateadd('d',-datepart('w',{table.Date},crTuesday),{table.Date})
IP Logged
roxaneamanda
Newbie
Joined: 10 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 23
Posted: 10 Feb 2010 at 4:03am
Hi,
If the {table.date} is the same as the week commencing date, this formula is returning the previous weeks Monday date???? eg
Date Created Week Commencing
08/02/10 9:00am 01/02/10
IP Logged
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 10 Feb 2010 at 7:31am
Sorry, didn't taqke that into account. Just add an if statement to handle that component:
if weekday({table.date},crMonday)=1 then {table.date} else
dateadd('d',-datepart('w',{table.Date},crTuesday),{table.Date})
IP Logged
roxaneamanda
Newbie
Joined: 10 Aug 2009
Location: United Kingdom
Online Status: Offline
Posts: 23
Posted: 10 Feb 2010 at 8:30am
Great. Works perfectly. Thanks
IP Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
delete your posts in this forum
You
cannot
edit your posts in this forum
You
cannot
create polls in this forum
You
cannot
vote in polls in this forum
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
BAEZL
© 2004-2026 Brian Bischof. All Rights Reserved.