Display all dates of current month

Hi There,

I have a current mysql database, with a registered date field.

What my client wants to do is to display the current dates of this month, and display the date in bold if it is the registered date.

So for example:

April

01, 02, 03, 04, 05, 06, 07,<b> 08 </b>, 09, 10, 11, ..... 31

So I guess it would need to just loop through the dates of this month (28, 30, or 31 : month dependent)  and just check on each loop if it = registered date

scooter41Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NopiusCommented:
Only February has flexible boundary. For any other month you may use an array of last dates.
For February you may always use 29
OR
if you like things to be more complex, substract 1-Mar from 1-Feb and get number of days of current year.
 
0
NopiusCommented:
Also it's more effective to create an array of days of the month (from 1 to 31),
then select entire month,
then do loop for registered dates (record-by-record) and set "<b>" "</b>" in appropriate array position,
then output from 1 to the last day of your month.
0
scooter41Author Commented:
I like the idea of the array, then loop, is there an easy way to get the current number of days in the current month..... in perhaps cgi or is it best to do in a mysql statement
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

NopiusCommented:
current number of days in the current month is better to be calculated in CGI.
So you don't need extra SQL requests just for data, that can be calculated locally.
What language are you using?
0
scooter41Author Commented:
Perl, thanks for your help so far, this is starting to make clearer sense now
0
NopiusCommented:
I'm not a perl guru, but something like this:

use Time::Local;
$now_time=gmtime();
$next_month=timegm(0,0,0,1,($now_time->mon+1) % 12, $now_time->year + (($now_time->mon+1)/12) );
$this_month=timegm(0,0,0,1,$now_time->mon,$now_time->year);
$days_between=($next_month-$this_month)/60/60/24;
0
NopiusCommented:
oops, bugs :)
probably:
1+ ($now_time->mon+1) % 13
instead of:
($now_time->mon+1) % 12
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scooter41Author Commented:
thanks heaps for your support, in this hour of need :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.