Welcome to my site!
Home Date Form Calculator Register PHP & MySQL refs

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

Date function formatting

charactermeaningexample
Y year as 4 digits 2012
y year as 2 digits 12
n month as 1 or 2 digits 2
m month as 2 digits 02
F month February
M month as 3 letters Feb
j day of the month as 1 or 2 digits 4
d day of the month as 2 digits 04
l day of the week Saturday
D day of the week as 3 letters Sat
g hour, 12-hour format as 1 or 2 digits 4
G hour, 24-hour format as 1 or 2 digits 16
h hour, 12-hour format as 2 diigits 04
H hour, 24-hour format as 2 digits 16
i minute 26
a am or pm pm
A AM or PM PM
s seconds 02
date('l, F j, Y, g:i:s a') yields Saturday, February 4, 2012, 4:26:02 pm
date('Y_m_d') yields 2012_02_04
date('Hi') yields 1626

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

The getdate() array

keyvalueexample
['year']year2012
['mon']month2
['month']month nameFebruary
['mday']day of the month4
['weekday']day of the weekSaturday
['hours']hours16
['minutes']minutes26
['seconds']seconds2

 

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

Session configuration settings

settingexamplemeaning
session.auto_start0If sessions should be automatically used (0 means no).
session.cookie_domainwww.acmenovelties.netURL wherein the session cookie should be accedssible.
session.cookie_lifetime0How long in seconds the session cookie should exist (0 means for the life of the browser).
session.cookie_path/The domain path wherein the cookie should be accessible.
session.cookie_secure0Whether or not the cookie must be sent over a secure connection (0 means no).
session.gc_probability1The odds of performaning garbage collection from 1 to 100.
session.gc_maxlifetime1440The time period in seeconds the session should last.
session.namePHPSESSIDThe name given to all sessions.
session.save_handlerfilesHow session data will be stored.
session.save_path/tmpWhere session data will be stored.
session.serialize_handlerphpWhat method should be used to serialize the session variables.
session.use_cookies1Whether or not teh session ID should be stored in a variable (0 means no).
session.use_only_cookies0Whether or not teh session ID must be stored in a cookie (0 means no).
session.use_trans_sid0Whether or not PHP should add the session ID to every link in an application.

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

 

MySQL tables

MySQL operators

operatormeaning 
=equals
<less than
>greater than
<=less than or equal to
>=greater than or equal to
!=not equal to
IS NOT NULLhas a value
IS NULLdoes not have a value
BETWEENwithin a range
NOT BETWEENoutside of a range
OR (also ||)where one of two conditionals is true
AND (also &&)where both conditionals are true
NOT (also !)where the condition is not true

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

MySQL Text Functions

functionusagepurpose
CONCAT()CONCAT(x, y, ...)Creates a new string of the form xy
LENGTH()LENGTH(column)Returns the length of the value stored in the column.
LEFT()LEFT(column, x)Returns the leftmost x characters from a column's value.
RIGHT()RIGHT(column, x)Returns the rightmost x characters from a column's value.
TRIM()TRIM(column)Trims excess spaces from the beginning and end of the stored value.
UPPER()UPPER(column)Capitalizes the entire stored string.
LOWER()LOWER(column)Turns the stored string into all lowercase.
SUBSTRING()SUBSTRING(column, start, length)Returns length characters from column beginning with start (indexed from 0).

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

MySQL Numeric Functions

functionusagepurpose
ABS()ABS(x)Returns the absolute value of x.
CEILING()CEILING(x)Returns the next-highest integer based upon the value of x.
FLOOR()FLOOR(x)Returns the integer portion of x.
FORMAT()FORMAT(x, y)Returns x formatted as a number with y decimal places and
commas inserted every three spaces.
MOD()MOD(x, y)Returns the remainder of dividing x by y (either or both can
be a column).
RAND()RAND()Returns a random number between 0 and 1.0.
ROUND()ROUND(x, y)Returns the number x rounded to y decimal places.
SIGN()SIGN(x)Returns a value indicating whether a number is negative (-1),
zero (0), or positive (+1);
SQRT()SQRT(x)Calculates the square root of x.

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

MySQL Date and Time Functions

functionusagepurpose
HOUR()HOUR(column)Returns just the hour value of a stored date.
MINUTE()MINUTE(column)Returns just the minute value of a stored date.
SECOND()SECOND(column)Returns just the second value of a stored date.
DAYNAME()DAYNAME(column)Returns the name of the day for a stored value.
DAYOFMONTH()DAYOFMONTH(column)Returns just the numerical day value of a stored date.
MONTHNAME()MONTHNAME(column)Returns the name of the month in a date value.
MONTH()MONTH(column)Returns just the numericaal month value of a stored date.
YEAR()YEAR(column)Returns just the year value of a stored date.
ADDDATE()ADDDATE(column, INTERVAL x type)Returns the value of x units added to column.
SUBDATE()SUBDATE(column, INTERVAL x type)Returns the value of x units subtracted from column.
CURDATE()CURDATE()Returns the current date.
CURTIME()CURTIME()Returns the current time.
NOW()NOW()Returns the current date and time.
UNIX_TIMESTAMP()UNIX_TIMESTAMP(date)Returns the number of seconds since the epoch or since the date specified.
available types: SECOND, MINUTE, HOUR, DAY, MONTH, YEAR -and- MINUTE_SECOND, HOUR_MINUTE, DAY_HOUR, YEAR_MONTH

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

MySQL DATE_FORMAT() and (TIME_FORMAT() parameters

termusageexample
%eDay of the month1 - 31
%dDay of the month (2 digit)01 - 31
%DDay with suffix1st - 31st
%WWeekday nameSunday - Saturday
%aAbbreviated weekday nameSun - Sat
%cMonth number1 - 12
%mMonth number (2 digit)01 - 12
%MMonth nameJanuary - December
%bMonth name, abbreviatedJan - Dec
%YYear2006
%yYear06
%lHour1 - 12
%hHour (2 digit)01 - 12
%kHour (24 hour clock)0 - 23
%HHour (24 hour, 2 digit)00 - 23
%iMinutes00 - 59
%SSeconds00 - 59
%rTime8:17:02 PM
%TTime (24 hour clock)20:17:02
%pAM or PMAM or PM

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

MySQL grouping functions

functionusagepurpose
AVG()AVG(column)Returrns the average value of the column.
MIN()MIN(column)Returns the smallest value in the column.
MAX()MAX(column)Returns the largest value in the column.
SUM()SUM(column)Returns the sum of all the values in the column.
COUNT()COUNT(column)Counts the number of rows.

Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables

ALTER TABLE clauses

clauseusagemeaning
ADD COLUMNALTER TABLE tablename ADD COLUMN
column_name VARCHAR(40)
Adds a new column to the end of the table.
CHANGE COLUMNALTER TABLE tablename CHANGE
COLUMN cloumn_name column_name
VARCHAR(60)
Allows you to change the data type and properties of a column.
DROP COLUMNALTER TABLE tablename DROP COLUMN
column_name
Removes a column from a table, including all of its data.
ADD INDEXALTER TABLE tablename ADD INDEX
indexname (column_name)
Adds a new index on column_name.
DROP INDEXALTER TABLE tablename DROP INDEX
indexnaame
Removes an existing index.
RENAME ASALTER TABLE tablename RENAME AS
new_tablename
Changes the name of a table.
© 2006 Robert Scott Truesdell and Acme Novelties