Jump to content

Comparing Week Numbers


Frazer

This topic is 8467 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Guys,

Really just a follow on from a previous posting on using dates in FMPro.

I have a database which contains seminar information. The end result I'm aiming for is for users to log onto a web site and be given a list of all seminars occurring in that week. Simple enough idea, however I'm having a problem using the "WeekofYear" function.

To get the current date I'm using the following code:

LeftWords(DateToText(Status(CurrentDate)), 1) &

MiddleWords(DateToText(Status(CurrentDate)), 2, 1) &

RightWords(DateToText(Status(CurrentDate)), 1)

I get the date as a whole number (e.g. 11th March 2001 reads 11032001).

The dates have been entered into the db as real language, under three fields, e.g.:

field example value

day 14

month March

year 2001

What I want to be able to do is run the WeekofYear function against both sets of dates (i.e. server date & inputed date). If they equal each other the answer is "1" and if not "0". This way I can run the query looking for the number "1" in a specific field and thus only pull up the current seminars.

Just can't seem to get it to work. Anyone tried this before and got a method that works?

Any suggestions would be greatfully received,

Thanks,

Frazer

Link to comment
Share on other sites

Sound like you're making it too hard. First for the server week:

Server Week (calculation, number) =

WeekofYear(Status(Current Date))

For the entered week:

Entered Week (calculation, number) =

WeekofYear(Date(

Case(

month = "January", 1,

month = "February", 2,

month = "March", 3,

month = "April", 4,

month = "May", 5,

month = "June", 6,

month = "July", 7,

month = "August", 8,

month = "September", 9,

month = "October", 10,

month = "November", 11,

month = "December", 12,

""), day, year))

-bd

Link to comment
Share on other sites

This topic is 8467 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.