Skip to main content
Inspiring
October 26, 2009
Question

create a calendar with month view

  • October 26, 2009
  • 2 replies
  • 1801 views

Hi,

I would like to know how I can create a calendar month view and populate my records into the relevant boxes.

My database:

CREATE TABLE IF NOT EXISTS `jobs` (
  `job_id` int(8) NOT NULL auto_increment,
  `job_day` varchar(10) collate utf8_unicode_ci NOT NULL,
  `job_date` varchar(10) collate utf8_unicode_ci NOT NULL,
  `job_start_time` varchar(10) collate utf8_unicode_ci NOT NULL,
  `job_finish_time` varchar(10) collate utf8_unicode_ci NOT NULL,
  `job_gross_hrs` varchar(6) collate utf8_unicode_ci NOT NULL,
  `job_break_hrs` varchar(6) collate utf8_unicode_ci NOT NULL,
  `job_total_hrs` varchar(6) collate utf8_unicode_ci NOT NULL,
  `job_job_role` varchar(255) collate utf8_unicode_ci NOT NULL,
  `job_got_signature` varchar(5) collate utf8_unicode_ci default NULL,
  `job_mileage` varchar(20) collate utf8_unicode_ci default NULL,
  `client_id` varchar(8) collate utf8_unicode_ci NOT NULL,
  `staff_id` varchar(8) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`job_id`),
  KEY `client_id` (`client_id`),
  KEY `staff_id` (`staff_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

I know my job_date is not in DATE format, that is due to my lack of knowledge of how to use DATE functions

I would ideally like to use a grid to display the date and the jobs within it.

This topic has been closed for replies.

2 replies

Inspiring
October 29, 2009

I've understood the DATE method but I cant put it in a calendar format

Inspiring
November 30, 2009

hi, is there another solution instead of dynamically creating the calendar?

As I cant seem to add any information to it.

David_Powers
Inspiring
October 26, 2009

The_FedEx_Guy wrote:

I know my job_date is not in DATE format, that is due to my lack of knowledge of how to use DATE functions

If you want to build calendar functionality, you need to learn how to use the DATE data type and related functions. Otherwise, you're just wasting your time.

Inspiring
October 26, 2009

Ok, so if changed my date column to DATE

And the dates are stored as YYYY/MM/DD

How would I go about creating the month view for the current month?

Is there a good book or website I can go through?

David_Powers
Inspiring
October 26, 2009

SELECT * FROM mytable

WHERE MONTH(job_date) = MONTH(NOW())

A good place to learn about the MySQL date and time functions is in the online manual: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html.