Login
Donate to Zikula
Wiki : ManipulatingDates
Documentation Home :: Categories :: Page Index :: recent changes :: Search :: Help :: Log in
last edit 2006-06-09 13:03:27 by Chestnut fixed links

Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate and endDate database fields).
Please read ManipulatingTables first. Your ADODB data dictionary lines for the startDate and endDate fields should be:
The simplest way to fetch a database record is to use the DBUtil::selectObjectByID function:
That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS'.
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID. These are displayed as a blank values when using the dateformat plugin.
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields). Please read ManipulatingTables first. Your ADODB data dictionary lines for the startDate? and endDate? fields should be:
The simplest way to fetch a database record is to use the DBUtil::selectObjectByID∞ function:
That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS∞' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS∞'.
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
edited 2006-06-08 20:58:28 by JørnWildt

Additions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loaded for the nice little calendar date picker you will get. This plugin does not add more than a calendar popup feature - you will have to add an <input> element for your self.
So far this is all you get. At the time of writing there is (to my knowledge) no dedicated features for reading dates back into the database. You will have to do date validation your self. You will also have to ensure the dates are in MySQL format before submitting them.
Deletions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
edited 2006-06-05 17:11:40 by JørnWildt

Additions:
CategoryDeveloperDocs
Deletions:
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
edited 2006-06-05 16:33:57 by JørnWildt

Additions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
Deletions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
edited 2006-06-05 16:29:26 by JørnWildt Working

Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (~startDate? and ~endDate? database fields).
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling ~DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
edited 2006-06-05 16:28:38 by JørnWildt Working

Additions:
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling ~DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
Deletions:
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank value when using the dateformat plugin.
edited 2006-06-05 16:28:00 by JørnWildt Working

Additions:
Deletions:
Empty Date Values
edited 2006-06-05 16:27:26 by JørnWildt Working

Additions:
The format used is that of PHP's date() function. Empty Date Values If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank value when using the dateformat plugin.
Deletions:
(Work in progress june 5th 2006)
The format used is that of PHP's date() function.
edited 2006-06-05 16:19:32 by JørnWildt Working

edited 2006-06-05 16:16:06 by JørnWildt Working

Additions:
Dates should be displayed like any other value in your pnRender template. The PHP code to do this would be: $render = new pnRender('course'); $render->assign('course', $course);
(HTML)
The format used is that of PHP's date() function.
Deletions:
edited 2006-06-05 16:07:07 by JørnWildt Working

edited 2006-06-05 16:06:44 by JørnWildt

edited 2006-06-05 16:06:29 by JørnWildt

Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (~startDate? and ~endDate? database fields).
The 'T' type specifier results in an ~MySQL DATETIME column.
That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS∞' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS∞'.
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
edited 2006-06-05 16:00:14 by JørnLind

Additions:
if (!DBUtil::createTable('courses∞', $SQL)) { ... }
Deletions:
if (!DBUtil::createTable('ht_table1∞', $SQL)) {
edited 2006-06-05 15:58:55 by JørnLind

Additions:
(Work in progress june 5th 2006) As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
Deletions:
(Work in progress june 5th)
Oldest known version of this page was edited on 2006-06-05 15:50:31 by JørnLind [ Starting dates documentation ]
(Work in progress june 5th)
Dates can be slightly difficult to handle correct all the way from the database to the UI and back again, so here's a short introduction to how it should be done.
Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate and endDate database fields).
Please read ManipulatingTables first. Your ADODB data dictionary lines for the startDate and endDate fields should be:
The simplest way to fetch a database record is to use the DBUtil::selectObjectByID function:
That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS'.
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID. These are displayed as a blank values when using the dateformat plugin.
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields). Please read ManipulatingTables first. Your ADODB data dictionary lines for the startDate? and endDate? fields should be:
The simplest way to fetch a database record is to use the DBUtil::selectObjectByID∞ function:
That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS∞' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS∞'.
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
edited 2006-06-08 20:58:28 by JørnWildt
Additions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loaded for the nice little calendar date picker you will get. This plugin does not add more than a calendar popup feature - you will have to add an <input> element for your self.
So far this is all you get. At the time of writing there is (to my knowledge) no dedicated features for reading dates back into the database. You will have to do date validation your self. You will also have to ensure the dates are in MySQL format before submitting them.
Deletions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
edited 2006-06-05 17:11:40 by JørnWildt
Additions:
Manipulating Date Values
There are still some undecided problems - The most import problem left is which format the user should enter the date in.CategoryDeveloperDocs
Deletions:
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
edited 2006-06-05 16:33:57 by JørnWildt
Additions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
There are still some undecided problems - The most import problem left is which format the user should enter the date in.
Deletions:
To use it you must remember to put <!--[pncalendarinit]--> somewhere one the page before it. This will ensure that the proper javascript and stylesheets are loader for the nice little calendar date picker you will get.
edited 2006-06-05 16:29:26 by JørnWildt Working
Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (~startDate? and ~endDate? database fields).
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling ~DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
edited 2006-06-05 16:28:38 by JørnWildt Working
Additions:
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling ~DBUtil::selectObjectByID∞. These are displayed as a blank values when using the dateformat plugin.
Deletions:
If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank value when using the dateformat plugin.
edited 2006-06-05 16:28:00 by JørnWildt Working
Additions:
Empty Date Values
Deletions:
Empty Date Values
edited 2006-06-05 16:27:26 by JørnWildt Working
Additions:
The format used is that of PHP's date() function. Empty Date Values If you have allowed SQL NULL values in your date columns you will get PHP null values back when calling DBUtil::selectObjectByID∞. These are displayed as a blank value when using the dateformat plugin.
Entering Date Value
There's a special pncalendarinput plugin to be used for entering date values: <!--[pncalendarinit]-->- enter start date: <!--[pncalendarinput ...]-->
Deletions:
(Work in progress june 5th 2006)
The format used is that of PHP's date() function.
edited 2006-06-05 16:19:32 by JørnWildt Working
edited 2006-06-05 16:16:06 by JørnWildt Working
Additions:
Dates should be displayed like any other value in your pnRender template. The PHP code to do this would be: $render = new pnRender('course'); $render->assign('course', $course);
- $render->fetch('course_user_view.html');
Course period: <!--[dateformat datetime=$course.startDate]--> - <!--[dateformat datetime=$course.endDate]--> The dateformat plugin will reformat your date value according to it's default date format specifier (unspecified so far). If you want a different format you can supply that yourself:
The format used is that of PHP's date() function.
Deletions:
edited 2006-06-05 16:07:07 by JørnWildt Working
edited 2006-06-05 16:06:44 by JørnWildt
edited 2006-06-05 16:06:29 by JørnWildt
Additions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (~startDate? and ~endDate? database fields).
The 'T' type specifier results in an ~MySQL DATETIME column.
Fetching Dates from the database
The simplest way to fetch a database record is to use the DBUtil::selectObjectByID∞ function: $course = DBUtil::selectObjectByID('course∞', $id);That is all! The $course variable will now contain your date values formatted as a 'YYYY-DD-MM HH:MM:SS∞' string which can be reformatted later on using various utility functions.
Remember: dates are always manipulated as strings in the format 'YYYY-DD-MM HH:MM:SS∞'.
Displaying Dates
Deletions:
As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
edited 2006-06-05 16:00:14 by JørnLind
Additions:
if (!DBUtil::createTable('courses∞', $SQL)) { ... }
Deletions:
if (!DBUtil::createTable('ht_table1∞', $SQL)) {
- 'errormsg', _CREATETABLEFAILED);
- false; }
edited 2006-06-05 15:58:55 by JørnLind
Additions:
(Work in progress june 5th 2006) As an example we can use a course module that lets you add and edit courses with starting and ending dates (startDate? and endDate? database fields).
Creating Date Fields in the Database
Please read ManipulatingTables first. Your ADODB data dictionary lines for the startDate? and endDate? fields should be:<?PHP
$SQL = "...
startDate T,
endDate T,
...";
if (!DBUtil::createTable('ht_table1', $SQL)) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
?>
$SQL = "...
startDate T,
endDate T,
...";
if (!DBUtil::createTable('ht_table1', $SQL)) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
?>
Deletions:
(Work in progress june 5th)
Oldest known version of this page was edited on 2006-06-05 15:50:31 by JørnLind [ Starting dates documentation ]
(Work in progress june 5th)
Dates can be slightly difficult to handle correct all the way from the database to the UI and back again, so here's a short introduction to how it should be done.

latest author:
Owner: