PHP - Calendar, Datepicker Calendar

The calendar component written in php script. It contains 2 modes: normal display calendar and date picker. See the demo below to check whether your browser support this script or not.
 
Demo:

Fixed Display Style

Date 1 :
  • Set default date to server date (Auto unset if date is disabled)
  • Set year navigate from 1890 to 2080
  • Allow date selectable from 1st Jan 1890 to 01 May 2045
  • Not allow to navigate other dates from above
  • Disable date of 10th, 13th, and 23th on each month
  • Start week on Monday
  • Show calendar weeks
  • Set/show tooltips
  • Set timezone to Australia/Melbourne

Code:

<?php
$myCalendar = new tc_calendar("date2");
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1890, 2080);

$myCalendar->dateAllow('1890-01-01', '2045-05-01', false);

$myCalendar->setSpecificDate(array("2039-01-10", "2039-01-13", "2039-01-23"), 0, 'month');

$myCalendar->startMonday(true);
$myCalendar->showWeeks(true);

//Tooltips
$myCalendar->setToolTips(array("2013-07-02", "2013-07-15", "2013-07-25"), 'ŞŢĂÎÂ şţăîâ אי אפשר test!', '');
$myCalendar->setToolTips(array("2013-06-06", "2013-06-01", "2013-06-05"), 'אי אפשר לבחור תאריך זה', 'month');
$myCalendar->setToolTips(array("1969-07-06", "2040-07-01", "2013-06-05")
, 'Δεν επιτρέπετε η επιλογή αυτής της ημέρας', 'month');
$myCalendar->setToolTips(array("1969-07-06", "2040-07-01", "2013-06-05")
, 'الإصدار الخاص بي ليس لديها الدعم للعام 2038 وفيما بعد!', 'month');
$myCalendar->setToolTips(array("1969-07-06", "2040-07-01", "2013-06-05"), 'の間の日付を選択してください', 'month');
$myCalendar->setToolTips(array("1969-07-06", "2040-07-01", "2013-06-05"), '올바르지 않은 값입니다', 'month');
$myCalendar->setToolTips(array("2013-06-06", "2013-06-11", "2013-06-15"), 'और बाद के वर्षों का समर्थन नहीं है!', 'month');
$myCalendar->setToolTips(array("2013-07-06", "2013-01-01", "2013-12-25"), 'วันนี้ไม่ได้รับอนุญาตให้มีการเลือก', 'year');
$myCalendar->setToolTips(array("2013-07-06", "2013-07-15", "2013-07-25"), '请选择日期%s之前一个', '');

$myCalendar->setTimezone("Australia/Melbourne"); $myCalendar->writeScript();
?>

DatePicker Style

Date 2 :
 Select
  • Default date to current server date (Auto unset if date is disabled)
  • Set year navigate from 1960 to 2015
  • Allow date selectable from 01 January 2010 to 01 March 2015
  • Allow to navigate other dates from above
  • Disable specific date 1, 13, and 25 of every month
  • Custom alert when calendar's value has been changed

Code:

<?php
$myCalendar = new tc_calendar("date1", true);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(01, 03, 1960);
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1960, 2015);
$myCalendar->dateAllow('1960-01-01', '2015-03-01');
$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
$myCalendar->setOnChange("myChanged('test')");
$myCalendar->writeScript();
?> <script language="javascript">
<!--
function myChanged(v){
alert("Hello, value has been changed : "+document.getElementById("date1").value+"["+v+"]");
}
//-->
</script>

DatePicker with no input box

Date 3 :
  • No default date
  • Set year navigate from 2000 to 2015
  • Allow date selectable from 13 May 2008 to 01 March 2015
  • Allow to navigate other dates from above
  • Date input box set to false
  • Set alignment left and bottom
  • Disable specific date 1, 4 April, and 25 December of every years
  • Disable specific date 10, 14 of every months
  • Disable 1 June 2011

Code:

<?php
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2000, 2015);
$myCalendar->dateAllow('2008-05-13', '2015-03-01');
$myCalendar->setDateFormat('j F Y');
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
$myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month');
$myCalendar->setSpecificDate(array("2011-06-01"), 0, '');
$myCalendar->writeScript();
?>

Date Pair Example

from:
to

Code:

<?php					
$date3_default = "2014-04-14";
$date4_default = "2014-04-20";

$myCalendar = new tc_calendar("date3", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($date3_default)) , date('m', strtotime($date3_default)) , date('Y', strtotime($date3_default)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2020);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date3', 'date4', $date4_default);
$myCalendar->writeScript();

$myCalendar = new tc_calendar("date4", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($date4_default)) , date('m', strtotime($date4_default)) , date('Y', strtotime($date4_default)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2020);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date3', 'date4', $date3_default);
$myCalendar->writeScript();
?>

Example of submiting value: click here

Download zip file: calendar.zip (47.43 KB.)
Version 3.71 (7 December 2013)

What's new

Version 3.71

  • [Fixed] Vulnerabilities update on REQUEST parameter - thanks Arvid V.
  • Minor bug fixed and adjustment

Version 3.70

  • [Added] setToolTips function to allow you to set tooltip on each date
  • [Added] setTimeZone function to allow you to set timezone to calendar

Version 3.69

  • [Added] Use php DateTime class to handle date and also support for year 2038 and later (limited to php version >= 5.3.0)
  • [Fixed] Check valid of Today date if it is in range of enabled date
  • Minor bug fixed and adjustment

Version 3.68

  • [Fixed] 1st and 31st (on each month) are always disabled when running with php4

Version 3.67

  • [Fixed] Javascript possible error on Date.parse
  • [Fixed] Add on-change javascript in dropdown datepicker mode

Version 3.66

  • [Fixed] json checking function produce error when the php does not support for json

Version 3.65

  • [Fixed] Date selected hilight error
  • [Added] Auto hide calendar and make it default property
  • [Added] Auto focus an overlapping calendar to the top

Version 3.64

  • [Fixed] Incorrect parameter submited on javascript that caused an invalid date returned

Version 3.63

  • [Changed] Make the DatePair function selectable on any dates. Date-from must be before Date-to, and on the other hand, otherwise it will be reset

Version 3.62

  • [Fixed] Error displaying date on Jan 2012 and some other months

Version 3.61

  • [Added] Display weeks
  • [Added] RTL supported
  • [Added] startDate function for selecting any days as start day of week
  • [Adjusted] Rearrange source code on calendar_form.php

Version 3.60

  • [Added] Add X as background of disabled days
  • [Fixed] 'Day' combobox contain no list dropdown when not call setDate() on initialization
  • [Fixed] Fixed display style still have the default value in case of the date is disabled.
  • [Fixed] 'Today' date color disappear when date is disabled.
  • [Fixed] Javascript error from IE compatible not support for JSON
  • [Adjusted] Change the color of today date to green with border

Version 3.59

  • Update to match the version with localization

Version 3.58

  • [Fixed] the value of calendar is not restored when using back button on browser

Version 3.57

  • [Fixed] update calendar.css display glitch

Version 3.56

  • [Fixed] error on checkSpecifyDate, calendar.js

Version 3.55

  • [Fixed] 'dateAllow' contains error on calendar_form.php

Version 3.54

  • [Update] 'setSpecificDate' to set on month, year, and no recursive simultaneuosly
  • [Added] 'setOnChange' to customize onChange event of calendar

Version 3.53

  • [Fixed] writeYear contains unused variable (error), sorry guys :(

Version 3.52

  • [Fixed] datepair error after cleaned up code (on version 3.50)

Version 3.51

  • [Added] check_json_encode and check_json_decode for the server that not support json

Version 3.50

  • [Added] setSpecificDate to enable or disable date specified
  • [Improved] Cleaning up and more validating source codes (thanks to Peter)

Version 3.41

  • [Fixed] calendar header - look tight
  • [Fixed] Using incorrect path on example file (index.php), forgot to add history logs on class file

Version 3.4

  • [Added] setAlignment
  • [Added] setDatePair

Version 3.3

  • [Fixed] Total number of days in datepicker mode on startup incorrectly appear (thanks to Francois du Toit, ciprianmp)

Version 3.2

  • [Fixed] Some confusion in date display when both dateAllow and setYearInterval are set in some cases
  • [Fixed] add 'zindex' property to tc_calendar, helps in overlapping component (ie6)
  • [Improved] Year navigate from newest to oldest

Version 3.1

  • [Added] disabledDay (thanks to Jim R.)
  • [Improved] Day style adjustable with css (.mon, .tue, .wed, .thu, .fri, .sat, .sun)

Version 3.0

  • [Fixed] day combobox not update (February case) when select date from calendar
  • [Fixed] auto resize not applied when calendar start in hide div mode (display: none;)
  • [Fixed] day combo box not update when selecting date < 10 (occured from v2.9)
  • [Fixed] (18 May 2010) glich on IE7 update on calendar_form.php and calendar.css
  • [Fixed] (22 May 2010) parseInt error on calendar.js function isDateAllow()

Version 2.9

  • [Improved] Auto adjust calendar size (width & height)
  • [Fixed] Valid day combo box when selecting month or year (input box mode)


Download tc_calendar with language pack (by Ciprian)

Demo: http://www.ciprianmp.com/scripts/calendar/
Download: http://www.ciprianmp.com/scripts/calendar/calendar_localized.zip

Copyright
This calendar datepicker is totally free to use. You can use it in all of your projects without any costs.
How to setup:

Only 2 steps requires for setup and use this calendar component.

Put the javascript file(.js) in the head section or somewhere else but it should be include once in a page.

<head>
<script language="javascript" src="calendar.js"></script>
</head>

Create form element in the html and put the following code

<form action="somewhere.php" method="post">
<?php
//get class into the page
require_once('classes/tc_calendar.php'); //instantiate class and set properties $myCalendar = new tc_calendar("date1", true);
$myCalendar->setIcon("images/iconCalendar.gif");
$myCalendar->setDate(1, 1, 2000);
//output the calendar
$myCalendar->writeScript();
?> </form>

How to get the value?

To get the date selected in calendar by php after submit the form, simple write script as the following:

<?php
$theDate = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : "";

?> 

The above script should be on another file that html form point to. The parameter 'date1' is the object name that you set in the code at the time calendar construct. See further in Functions and Constructor below.

To get the date selected by javascript on the current page, write script as the following:

<form action="somewhere.php" method="post" name="form1">
<?php
//get class into the page
require_once('classes/tc_calendar.php'); //instantiate class and set properties $myCalendar = new tc_calendar("date1", true);
$myCalendar->setIcon("images/iconCalendar.gif");
$myCalendar->setDate(1, 1, 2000);
//output the calendar
$myCalendar->writeScript();
?> </form> //use javascript to get the value <script language="javascript"> <!-- function showDateSelected(){ alert("Date selected is "+document.form1.date1.value); } //--> </script> //create link to click and check calendar value <a href="javascript:showDateSelected();">Check calendar value</a>

Calendar Properties

rtl - specify the right-to-left direction of calendar

Ex. $myCalendar->rtl = true;

zindex - specify the zindex value to calendar

Ex. $myCalendar->zindex = 99;

Calendar Functions

Constructor

tc_calendar (string bindObjectName)

tc_calendar (string bindObjectName, boolean date_picker)

tc_calendar (string bindObjectName, boolean date_picker, bool show_input)

date_picker default value is false.
show_input default value is true

Methods

autoSubmit (bool flag, string form_name, string target_url)

Specify the calendar to auto-submit the value. Default value of autosubmit is false

To set calendar auto submit, specify flag to true and you need to specify either form_name or target_url to make the calendar to perform autosubmit correctly

Ex 1. $myCalendar->autoSubmit(true, "myForm");
//assume that the calendar is in the form named 'myForm', then tell the calendar to auto submit the value (other values in myForm will be submitted together by html post method)

Ex 2. $myCalendar->autoSubmit(true, "", "anywhere.php");
//tell the calendar to submit the value to 'anywhere.php'. This method will submit only calendar value via html get method

dateAllow (date from, date to, bool navigate_not_allowed_date)

Specify date range allow to select. Other dates from input will be disabled. The parameter navigate_not_allowed_date will handle the user to navigate over the disable date, default is true (means allow)

Specify both date from and to will set range of date user can select.
Specify only date from or to will set range from/upto year set by setYearInterval method.

Ex 1. $myCalendar->dateAllow('2008-05-13', '2010-03-01', false); //allow user select date from 13 May 2008 to 1 Mar 2010
Ex 2. $myCalendar->dateAllow('2008-05-13', '', false); //allow user select date from 13 May 2008 upto whatever can navigate
Ex 3. $myCalendar->dateAllow('', '2010-03-01', false); //allow user select date from whatever can navigate upto 1 Mar 2010

disabledDay (string day)

Specify day column to be disabled. Possible day value: Mon, Tue, Wed, Thu, Fri, Sat, Sun

Ex. $myCalendar->disabledDay('Sun'); //disable Sunday column

getDate ()

Get the calendar value in date format YYYY-MM-DD

Ex. $myCalendar->getDate(); //return 2009-06-19

setAlignment (string horizontal_align, string vertical_align)

Optional: Set the alignment of calendar datepicker with the calendar container. The value of horizontal alignment can be 'left' or 'right' (default) and the value of vertical alignment can be 'top' or 'bottom' (default).

Ex. $myCalendar->setAlignment('left', 'top');

setAutoHide (bool auto, int delay_time)

Optional: Set an auto hide of calendar when not active. The calendar has default value of auto hidden since version 3.65 with default delay time of 1000 (1 second)

Ex 1. $myCalendar->setAutoHide(true, 3000); //auto hide in 3 seconds
Ex 2. $myCalendar->setAutoHide(false);

setDate (int day, int month, int year)

Optional: Set default selected date to the value input. For month parameter: January=1 and December=12

Ex. $myCalendar->setDate(15, 6, 2005); //Set the date to 15 June 2005

setDateFormat (string format)

Optional: Set the format of date display when no input box. Apply with 'showInput' function

Ex. $myCalendar->setDateFormat('j F Y'); //date will display like '9 September 2009'

setDatePair (string calendar_name1, string calendar_name2, string default_pair_value)

Optional: Set a date pair link to calendar object. This function will work when 2 calendars are setup together.

Ex 1. $myCalendar->setDatePair('date1', 'date2'); //This means when the value of calendar 'date1' is set, the calendar 'date2' will not allow to select the date prior to 'date1'
Ex 2. $myCalendar->setDatePair('date1', 'date2', "2011-03-26"); //suppose you are setting this value on date1 object, '2011-03-26' will be assigned as default date of date2 and calculated

setIcon (string url)

Optional: Set icon in date picker mode. If the icon is not set the date picker will show text as link.

Ex. $myCalendar->setIcon("images/iconCalendar.gif");

setHeight (int height) - deprecated since v2.9 - auto sizing applied

Optional: Set height of calendar. Default value is 205 pixels

Ex. $myCalendar->setHeight(205);

setOnChange (string value)

Optional: Set the onchange javascript function to calendar

Ex. $myCalendar->setOnChange("javascriptFunctionName()");

setPath (string path)

Optional: Set the path to the 'calendar_form.php' if it is not in the same directory as your script. The path string is a relative path to the script file.

Ex. $myCalendar->setPath("folder1/");

setSpecificDate (array dates, int type, string recursive)

Optional: Set the specific to enable or disable.

dates: the array of date, and date should be in format YYYY-MM-DD
type: enable or disable the date specified. 0=disable, 1=enable
recursive: '' (blank)=no recursive, calendar will process only on exact date, 'month'=monthly recursive, or 'year'=yearly recursive

Ex 1. $myCalendar->setSpecificDate(array("2011-04-22"));
Ex 2. $myCalendar->setSpecificDate(array("2011-04-22"), 0, 'month'); //disable date 22 every month
Ex 3. $myCalendar->setSpecificDate(array("2011-04-22"), 0, 'year'); //disable 22 Apr on every year

setText (string text)

Optional: Set text to display. The text will show in date picker mode when the icon is not set.

Ex. $myCalendar->setText("Click Me");

setTimezone (string timezone) - New!

Optional: Set timezone to calendar. The valid timezone string is as specified on http://php.net/manual/en/timezones.php

Ex $myCalendar->setTimezone("Europe/London");

setToolTips (array dates, string tooltip, string recursive) - New!

Optional: Set the tooltip info to be displayed on certain dates, recursively or not.

dates: the array of dates, and date should be in format YYYY-MM-DD
tooltip: string/text to be displayed when mouse hover the info.gif icon in the top-right corner of each day
recursive: "" (blank)=no recursive, calendar will process only on exact date, "month"=monthly recursive, or "year"=yearly recursive
hint: the function can be called any number of times, like all 5 examples below, together; multi-tooltips will be displayed on multi-lines, in this main order: non-recurrent, monthly then yearly, and then in the order of calling the function.

Ex 1. $myCalendar->setToolTips(array("2013-07-06", "2013-07-15", "2013-07-25"), "Tooltip Test");
Ex 2. $myCalendar->setToolTips(array("2013-06-06", "2013-06-01", "2013-06-05"), "Monthly Tooltip", "month");
Ex 3. $myCalendar->setToolTips(array("2013-06-06", "2013-07-11", "2013-09-15"), "Second Monthly Event", "month");
Ex 4. $myCalendar->setToolTips(array("2013-06-06", "2013-01-01", "2013-12-25"), "Yearly Event", "year");
Ex 5. $myCalendar->setToolTips(array("2013-07-06", "2013-07-15", "2013-07-25"), "Second Tooltip test");

setWidth (int width) - deprecated since v2.9 - auto sizing applied

Optional: Set width of calendar. Default value is 150 pixels

Ex. $myCalendar->setWidth(150);

setYearInterval (int year_start, int year_end)

Optional: Set the year start and year end display on calendar combo box. Default value is +15 and -15 from current year (30 years)

Ex. $myCalendar->setYearInterval(1970, 2020);

showInput (bool flag)

Optional: Set the input box display on/off. If showInput set to false, the date will display in panel as example above 'DatePicker with no input box'. Default value is true

Ex. $myCalendar->showInput(false);

showWeeks (bool flag)

Optional: Display weeks on calendar upon setting. Default value is false.

Ex. $myCalendar->showWeeks(true);

startDate (bool date_number)

Optional: You can choose any day as a start day of week. The possible values are 0 (for Sunday) through 6 (for Saturday). Default value is 0 (Sunday)

Ex. $myCalendar->startDate(6); //start day of week is Sat.

startMonday (bool flag) - deprecated since v3.61 - use startDate instead

Optional: Set whether the calendar will be start on Sunday or Monday. Set flag to true means the calendar will display first date as Monday, otherwise false will display first date as Sunday. Default value is false.

Ex. $myCalendar->startMonday(true);

writeScript()

Write the output calendar to the screen

 

 

Visitor Review  Write a review
Search Review :

krishna on 30 Mar 2014 02:32 reply

cool calender


I want to disable the all the days previous to current date. how can i do it.


help me ....thnaks for time

krishna on 30 Mar 2014 02:54 reply

i hv used this
$myCalendar->dateAllow(date('Y-m-d'), '2016-12-31' );
but it disables all selection process :/
the i click javascript ...it say
the local host say : 0000:00:00
i hv used below code
<form name="form1" method="post" action="">
<?php
$myCalendar = new tc_calendar("date2");
$myCalendar->setIcon("calendar/images/iconCalendar.gif");

$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");

$myCalendar->setYearInterval(2010, 2020);
//$myCalendar->dateAllow('2012-01-10', '2016-12-31', true);
$myCalendar->dateAllow(date('Y-m-d'), '2016-12-31' );

$myCalendar->startDate(7);
$myCalendar->autoSubmit(true, "form1");
$myCalendar->showWeeks(true);
//Tooltips
$myCalendar->setToolTips(array("2013-12-25"), "Merry Chirstmas", "year");
$myCalendar->setToolTips(array("2013-01-01"), "New Year", "year");

$myCalendar->setTimezone("Asia/Calcutta");
$myCalendar->writeScript();
?>
<p>
<input type="button" name="button3" id="button3" value="Check the Date" onClick="javascript:alert(this.form.date2.value);">
<input type="button" name="button4" id="button4" value="Set Date to today" onClick="javascript:setCalendarValue1();">
<script type="text/javascript">
<!--
function setCalendarValue1(){
setValue('date2', '<?=date("Y-m-d");?>');
}
//-->
</script>
</p>
-----------------------------------------
php calender date picker ...version 3.71
thanks

Michael Mason on 12 Apr 2014 18:01 reply

I use dthis Krishna:


$myCalendar->dateAllow(date('Y-m-d'), '2015-12-31');

Still having trouble with other things though. Always getting the error "Error! Calendar Value Cannot Be Set!"

Any suggestions guys...?
 

Raymond Verbrugghe on 26 Mar 2014 04:49 reply

Is the 1970 problem solved in the localized version ? I am having a problem in accepting dates before 1 jan 1970 in a localizaed version (3.70).
Apart from this problem it seems to be a nice product.

ciprianmp on 26 Mar 2014 05:59 reply

Hi Raymond,
I just tested the published 3.70 on my server http://ciprianmp.com/scripts/calendar/ and, as I recalled, it works just fine with dates as early as from 1900.
Are you sure you have the latest official one? If so, then might be a limitation given by your server environment, which we thought we covered it all.
Is the current standard 3.71 handling those early dates on your server? Can you test please?
If it's only a v3.70loc limitation, then you'll have to wait a few more days/weeks until I will push the 3.71 upgrade into it. Make sure you like our Fb page so you can get the release announcement on time.
But if the issue is also present with 3.71std, we might need you to provide more info on your current server env (apache/php version, any zend engines on, safe mode status, cgi, etc).
Raymond on 26 Mar 2014 06:17 reply

Thx, this was a super fast reply.
I have followed your advice and re-downloaded the 3.70 and indeed it works fine.
The problem was not present in the 3.71 version which I tested before however I needed a Dutch translation and therefor downloaded the 3.70 localized version. So all is well now - probably my mistake?
ciprianmp on 26 Mar 2014 07:20 reply

I'm glad it works. Not your fault, I might have pushed the fix under the same version, after you got the buggy one. Not sure, long time ago ;)

PS: even when you post follow-ups here, keep put your email so you get notifications of replies.
 

martin on 24 Mar 2014 17:49 reply

Hello,
first I want to thank you - this solution is the one fits me best.

I got some issues and maybe you can help me (as Iam newbie to programming).

1st:
I use "DatePicker with no input box" and want to know, why it is loading so long. It takes 15secs before i can click on icon and calendar opens.
Have you got any hit for this?

2nd:
Is regarding "setSpecificDate" - I have dates "not available" in mysqlDB. So i created function that creates variable $result.
When you echo it you get:
"2014-03-20","2014-03-24" ...and so on. So it contains delimited and enclosed values.

but when I have this, it does not work - there is no date unavailable :(

$myCalendar->setSpecificDate(array($result), 0, ');

Can anyone see, where i did mistake?

Thank you very much.
martin

 

zommit adel on 17 Mar 2014 12:34 reply

Not bad as a beginner (y)

 

lav on 11 Mar 2014 00:41 reply

hello! thank you for this! such wide variety for calendar. elegant design is awesome <3 haha. will be using precode of this for our thesis. thank you again!

 

Art Beveridge on 06 Mar 2014 13:02 reply

Great tool!

I have one small bug... when I use setDate to set the default date based upon a value from a data table, and that date happens to equal the dateAllow start date or end date, the setDate value is ignored. ANy idea what might cause that, and is there any way to fix it?

 

apl on 09 Feb 2014 08:15 reply

I like this a lot. thanks.

One question. How can I apply style to the date selection boxes?

At the moment, if I put the date picker within a div, the styling for the div seems to be ignored by the calendar

 

chin2 on 03 Feb 2014 22:02 reply

Thank you, i found this very useful.. once again thanks

 

alonso on 22 Jan 2014 03:27 reply

Great job guys,
I have a question , we got many calendars in many pages , but how can i configure just one page calendar and the same info appear in the others pages. thx

 

alonso on 21 Jan 2014 00:39 reply

Hola , gracias por la aplicacion muy buena ,
tengo una duda , tengo el calendario en varias paginas , pero quiero que los mismos datos de una pagiina se reflejen en todas las paginas sin necesidad de cambiar informacion en todas las paginas.

 

David on 10 Dec 2013 01:53 reply

This is excellent thanks

How would I rewrite $mydate as "Friday the 12th of December" or even DD-MMM-YYYY rather than YYYY-MM-DD

TJ on 11 Dec 2013 21:20 reply

You can try

$your_date = date('F d Y', strtotime($date_value));

check the date format here
http://php.net/manual/en/function.date.php
Dave on 11 Dec 2013 21:32 reply

ahhh yes...(penny drops)

I was thinking I could do it in a procedure in MySQL too

Thanks buddy...I'm still finding my feet in PHP I appreciate the help

And thanks heaps for your calendar, very nice
 

kenji on 05 Dec 2013 08:15 reply

im not understand at all..can u teach me step by step from scratch?

im sorry to be so noob...but im really need this calendar coding...

or can anybody prepare a complete excutable php form for DatePicker style for me???

thx a lot

 

jemyr on 15 Nov 2013 14:36 reply

nice date picker i do hav 1 question.. how to set the value date to no value.. i mean to set it first with no value? tanx

 

vinod on 13 Nov 2013 21:28 reply

I am getting this error when i am using interval dates


checkdate() expects parameter 3 to be long, string given in calendar/classes/tc_date_main.php on line 115

 

Larry Curcio on 10 Nov 2013 05:46 reply

How do I get the date selected in the calendar to show with the circle around it. When I show the calendar and a date is click it shows correctly and the date getting into PHP is updated. Because of form edits, when I re-display the page/form, the date is no longer selected and must be clicked again.

Is there a setting I am missing?

Thanks!

 

Fernando on 06 Nov 2013 19:01 reply

Hola soy de argentina. Como cambio la zona horaria TIMEZOME??? Look image
http://s2.subirimagenes.com/imagen/previo/thump_8687098date.png

Fernando on 06 Nov 2013 19:04 reply

<?php
require_once("classes/tc_calendar.php");
date_default_timezone_set('America/Argentina/Buenos_Aires');
setlocale(LC_ALL, NULL);
setlocale(LC_ALL,"es_AR");
$date = date("Y-m-d");
$day = date('d', strtotime($date));
$month = date('m', strtotime($date));
$year = date('Y', strtotime($date));
$myCalendar = new tc_calendar("fecha_pag", true);
$myCalendar->setIcon("imagenes/iconCalendar.gif"); $myCalendar->setDate($day, $month, $year);
$myCalendar->setDateFormat("Y-m-d");
$myCalendar->writeScript();
?>
 

Peter van de Kerkhof on 03 Nov 2013 01:00 reply

Hi,
is it possible to have a variant of example: DatePicker Style Date 2 :
but in ANSI Format: YYYY MM DD

 

Carlos Cordeiro on 17 Oct 2013 08:53 reply

Very nice job - congratulations!
My question...
How can I set the day to 01 when setting the month (clicking)

TJ on 17 Oct 2013 21:37 reply

Hi,

The easiest way is to modify the calendar.js on function tc_setMonth from

if(isDate(date_array[2], mvalue, date_array[0])){
tc_setDMY(objname, date_array[2], mvalue, date_array[0]);
}else document.getElementById(objname+"_month").selectedIndex = date_array[1];

to

if(isDate(date_array[2], mvalue, date_array[0])){
tc_setDMY(objname, 1, mvalue, date_array[0]);
}else document.getElementById(objname+"_month").selectedIndex = date_array[1];

Another way is to write a custom javascript function and attach it through
$myCalendar->setOnChange("yourFunction()");
Carlos Cordeiro on 18 Oct 2013 09:16 reply

I did that and nothing happened. I decide to put comments /* */ all the entire function and nothing again.
Then I put comments on the all those functions
function tc_setDay(objname, dvalue)
function tc_setMonth(objname, mvalue) and
function tc_setYear(objname, yvalue)
and again the object works as before
I modify the name calendar.js to Xcalendar.js then the object stopped working.
Any sugestion?
Carlos Cordeiro on 18 Oct 2013 17:48 reply

My target is to set day to 01 when changing the month by clicking. I could do that when the month is changed using arrows to rigth and left, acessing archive calendar.js function move(m, y) but dont know how to select day 01 when the month is changed using calendar form.
function move(m, y){
var f = document.calendarform;
f.selected_day.value = "01";
f.selected_month.value = m;
f.selected_year.value = y;
f.m.value = m;
f.y.value = y;

this.loading();
f.submit();
}
thak you in advance
 

ntx dev on 06 Oct 2013 10:30 reply

i like (in date pair) when user selected "date3" in calendar "date4" update the day,month and year for continue the selection, it is posible?
i test with getday() and with setonchange bu i can get the "date3 selected for update the "date4"
Thanks !

 

raja kumarb on 26 Sep 2013 09:09 reply

hi, working fine, really it is wonderful code

 

Marian on 23 Sep 2013 09:41 reply

I wanna know how can i take the date for a PHP variable... at the same time that i select in the calendar?

 

peter on 19 Sep 2013 03:46 reply

How long are you programmers?

Damn what a fucking MASS!!

 

MDL on 16 Sep 2013 04:44 reply

How did you create the visual view of the calender? did you used any other language or designing S/W to create it?

 

MDL on 16 Sep 2013 04:42 reply

How did you create the visual view of the calender? did you used any other language or designing S/W to create it?

 

Michael on 11 Sep 2013 04:15 reply

Hi,
how can I put portuguese as a default language for the date picker?

Thank you

ciprianmp on 11 Sep 2013 06:43 reply

Hi Michael. Please make sure you have the localized version from here: http://ciprianmp.com/scripts/calendar .
You find instructipns there and also a Greek sample.
All the best.
Michael on 12 Sep 2013 09:13 reply

Hi,
I have localized that version and follwed instructions but didnot succeed :(
Here is the link:

http://adcampanario.pt/material/material1.php

Michael on 12 Sep 2013 09:14 reply

Hi,
I have localized that version and follwed instructions but didnot succeed :(
Here is the link:

http://adcampanario.pt/material/material1.php

Michael on 12 Sep 2013 09:14 reply

Hi,
I have localized that version and follwed instructions but didnot succeed :(
Here is the link:

http://adcampanario.pt/material/material1.php
ciprianmp on 12 Sep 2013 10:30 reply

Did you start from using the sample.php ?
Send me a zip with the files concerned. You have my email, right?

ciprianmp on 12 Sep 2013 10:31 reply

Did you start from using the sample.php ?
Send me a zip with the files concerned. You have my email, right?
 

Miguel on 11 Sep 2013 04:10 reply

Hi,
how do I use portuguese as a default language for the calendar?

thank you!

 

Ben on 22 Aug 2013 11:53 reply

@ciprianmp - The code only produces the word "and" when its submitted.

was thinking about putting "$mydate1 = isset($_REQUEST["date3"]) ? $_REQUEST["date3"] : "";"

Somewhere in the code after its submitted to get it to process

ciprianmp on 22 Aug 2013 13:45 reply

Sorry, I assumed you have those two lines in the php header of your file (somewhere before the <html> tag):
$date3 = isset($_REQUEST["date3"]) ? $_REQUEST["date3"] : "";
$date4 = isset($_REQUEST["date4"]) ? $_REQUEST["date4"] : "";

And make sure the names for the 2 calendar forms are date3 and date4.

ciprianmp on 22 Aug 2013 13:46 reply

Please use the "reply" link for threaded conversations. Thanks.
Ben on 22 Aug 2013 15:09 reply

Sorry I couldn't find my OP. So this might be a weird one but i put that code where you said to put it and that works but how do i get it to grab the $date3/$date4 on submit so it can be parsed in an .asp file?
ciprianmp on 23 Aug 2013 02:15 reply

One option would be to put the right file in the main form :
<form name="form1" method="post" action="youraspfile.asp?date3=<>php echo($date3); ?>&date4=<?php echo($date4); ?>">
or use the hidden input fields in the asp file to get the submitted values
or use this.form.date3.value to get the value with javascript.
I recall it was discussed here a few times, looking for the best approach. I don't know which will fit your case best.
You shall try the search function on the top of the forum.

Anyway, once you have the submitted values return to a php file and/or javascript, you can handle them wherever you wish on your other files.
 

sakthi on 16 Aug 2013 23:54 reply

can help me out for populated calendar form in php with two date picker(start & end date)...


Thanks....
reply me ASAP

ciprianmp on 17 Aug 2013 00:02 reply

Open the included index.php in the zip and follow the dual calendar coding example. If it's another issue you encounter, let us know.
 

Jay on 07 Aug 2013 01:38 reply

Excellent - developed for easy implentation and just what I needed for my custom PHP website admin areas!

ciprianmp on 17 Aug 2013 00:04 reply

We are glad you like it. Thank you!

ciprianmp on 17 Aug 2013 00:05 reply

We are glad you like it. Thank you!
 

Jim on 29 Jul 2013 12:18 reply

Great Datepicker, well done. Do have a question regarding targeting a hidden form field already on my page. How would I do this in javascript? I want the hidden field to update as the date is changed. Thanks for a great program.

Jim on 29 Jul 2013 15:05 reply

Figured it out... added:
$myCalendar->setOnChange("myChange()");

And javascript:

<script>
function myChange(){
document.getElementById('myId').value = document.formName.myDateVariable.value;
return true;
}
</script>

Placed javascript right after body tag. The definitions are:

myId = the id of my input field
formName = the name of my form
myDateVariable = Variable name used in
$myCalendar list

Great datepicker script.
ciprianmp on 29 Jul 2013 15:18 reply

Glad you figured it out. Happy you like it. Sorry we've been so slow. ;)
 
See all reviews 1 2 3 4 5 6 7 8 9 10 Next»
Write a review
Rating:
Your Message:
Name:
Email:
(optional)
(Your email that entered here will not show anywhere on website and will use only reference when someone reply your post)
  I want to receive a copy of email on this post (your email is needed)
 
Code:
 

Search this site