Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Days in month #2 Jump to:  
Category: >> PHP Code >> Days in month #2 Bookmark and Share

<< lastnext >>

Snippet Name: Days in month #2

Description: Returns the number of days in the month for this month and this year.

Also see:
» Get Relative Dates and Times
» Convert UK Dates To mySQL Format Dates
» Calculate the difference between two t...
» FUNCTIONS: date/time
» Get Date 30 days ago
» Perl SQL Update Example
» SELECT: Select For Update
» TO_DATE
» UPDATE: Update a partitioned table
» UPDATE: Update based on a record
» UPDATE: Update Object Table
» UPDATE: with RETURNING clause
» UPDATE: Nested Table Update example
» UPDATE: Correlated Update
» UPDATE: Update from a SELECT statement
» UPDATE: based on multiple returned val...
» UPDATE: Update based on a query
» UPDATE: Update multiple rows
» UPDATE: update a specific record
» UPDATE: Single row
» Date Functions: NUMTOYMINTERVAL
» Date Functions: NUMTODSINTERVAL
» Date Functions: EXTRACT
» Date Functions: TO_DSINTERVAL
» Date Functions: TO_NCHAR
» Date Functions: TO_YMINTERVAL
» Dates: Oddball Stuff
» Date Functions: Calculate elapsed time...
» Date/Time Calculations: Get seconds be...
» Date: Find first day of the month

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?PHP
 
/*
days_in_month($month, $year)
Returns the number of days in a given month and 
year, taking into account leap years.
 
$month: numeric month (integers 1-12)
$year: numeric year (any integer)
 
*/
 
FUNCTION days_in_month($month, $year){
// calculate number of days in a month
RETURN $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
?> 
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 102 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?