Display Current Year

guys,can you help me with my drop down menu for year selectin my
in my current codes its displays the year from 2001 to 2007
now what i wanted to happen is it will display the year
from 2007 to 2001this is my current code which displays the year from 2001 to 2007
hope you could help me with this.
<?phpfor($i=2001; $i<=date("Y"); $i++){
   print '<option value="'.$i.'"';
   if($yearText == $i){
  print ' selected';


Datetime - Display Current Year Starting On August 1?

I need a PHP function that displays the previous year until August 1, at which point it should display the current year.

For example:

today is May 12, 2011, so this should echo "2010" when it's August 1, 2011 this should echo "2011" ...continue to echo "2011" until August 1, 2012 on August 1, 2012, it should echo "2012" etc.

View 3 Replies View Related

Html - Select <option Selected=""> Doesn't Work - Year And Month Automatically Sets To The Current Year And Current Month

I have 3 html <select> the year, month, and day. Both the year and month automatically sets to the current year and current month. I did that purely in PHP. However, the day which is being triggered by Javascript doesn't seem to work even though I already did if (j == <?php echo date('d') ?>) days_select.options[days_select.options.length] = new Option(j, j, true);

The default day is still 1 not the current day. What is even frustrating is that when I checked it on firebug the selected day is the current day... I am a total noob in programming that's why simple things like these are kinda hard for me to grasp.

<body onload="loadDays();">
<script type="text/javascript" >
function loadDays() {
var year = parseInt(document.getElementById('years').value);
var month = document.getElementById('months').value;
var months = new Array

View 2 Replies View Related

CC Expiration Year - Select Box To Be Populated With The Current Year

I am trying to code a select box to be populated with the current year and the following 10 yrs. I'm guessing it is pretty easy but I'm not sure how to get started. Should I do a for loop that runs x10 and adds to an array??

View 4 Replies View Related

Getting Rows In Particular Week Of The Current Month Of The Current Year?

I'm wanting to find rows whose date is within the next week of the current month of the current year. The format of the date is, for example: 2010-10-28

View 4 Replies View Related

"On" Style Reflects Current Year Tab If No Year Is Selected?

I have a script that pulls data from my dB based on the year selected from 2006 - 2011, and if no year is selected it automatically loads the current year, 2011. I have a css that changes the design of the "tab" based on the year selected, but how do I make it so that the "On" style reflects the current year tab if no year is selected? Confused yet? I created an image of what I mean as well as the php script.


View 2 Replies View Related

Combining Queries - One Query Gets The Current Year And The Other Query Gets Last Year

i have these two querys selecting different dates from a table what would be the best way to get the difference like QuoteWHERE `MONTH` >= '". $data_lastfs . "' AND '" . $data_lastfsend . "' >=  `MONTH` one query gets the current year and the other query gets last year.

View 3 Replies View Related

Shortcut For Current Year

anybody know a better way / shortcut for doing this: PHP Code:

$gda = getdate();
$current_year = $gda['year'];
$return = myfuction($current_year);

I just want to use the current year as a function arg. So, I don't even want to use the var $current_year. Maybe do this block in one line.

View 2 Replies View Related

Find Current Day Of Year

Is there a standard function in PHP that will find the day number of the year based on the current date? Examples:

Jan 22nd = 22
Feb 27th = 58
Mar 5th = 64

If there isn't a standard function, has anyone built anything similar that would handle the conversion? What all is involved?

View 4 Replies View Related

Get The Date Of First Monday Of The Current Year?

how to get the date of first monday of the current year using php functionsexample 04-01-2010

View 1 Replies View Related

Scripts Where In Some Of Them The Current Year Is Set Like '2009'?

I have several php scripts where in some of them the current year is set like '2009' so hard coded.I wonder if and how I can replace this with a variable which i can refer to.In some scripts the year is stated in a Query, in some it's just text.Problem is that every year I have to update several scripts. I need at least one script with year previous of current year like "scriptname_2008"Actually, would be nice if this became a variable too..If I'm thinking correct, I'd never have to update anything manually again.One main script would get the current year, create a variable of this.Same for the previous year.

View 21 Replies View Related

How Do I Retrieve The Current Year To Insert To The Database.

how do I retrieve the current year to insert to the database. And how the date data is stored? is it yyyy/mm/dd or yyyy/dd/mm?

View 4 Replies View Related

Grab Data Whatever The Current Month And Year Is

I have database with a date field and I would like to have a query setup to grab data from it using whatever the current month and year is. My date field is currently in the 0000-00-00 format. I wanted to know if this can be done.

View 3 Replies View Related

Echo Current Month And Year In PHP5?

what would be the shortest, simples code to generate the curent month in Full english September or short as three letter version like Feb and then add the current Year 2011

So the code will, depending on the month and year, echo stuff like:

July 2011


Aug 4037


View 1 Replies View Related

Get The Number Of Weeks Of Current Year Using Zend_Date Class?

how can we get number of weeks of current year, for example if it's 2009 there are 53 weeks and 2010 has 52

View 1 Replies View Related

Finding Date Range For Current Week, Month And Year?

Suppose I have a date available with me:

2011-04-05 (i.e., 5th April, 2011)

I want to find date range for Current Week, Month and Year

Current Week: 3rd April to 9th April
Current Month: 1st April to 30 April
Current Year: 1st Jan to 31 Dec

I do understand that current year would be always 1st Jan to 31Dec, but what about current month and week, How can I find it?

Edit:How can I find date, which is 10 days earlier or later from a given date.

Example: Suppose today's date is 6th April, 2011
10 day's earlier: 28 March, 2011
10 day's later: 15 April, 2011

View 4 Replies View Related

Echo Out A Table Showing The Days Of The 'current Month / Year?

How would I echo out a table showing the days of the 'current month/year?

1-may-10 - data here
2-may-10 - data here
prev month - next month

View 7 Replies View Related

Display Data By Year

I need to display records from a db for this year only. This is what I've been trying: PHP Code:

$thisyear = date("Y");
SELECT * FROM table WHERE date("Y",strtotime(update)) = $thisyear

does anyone know if this is the correct way?

View 4 Replies View Related

Dynamicaly Display Month And Year

Hi how can i display month and years dynamically without using database in a drop down menu.

<select name=month>
<option value=1>January</option>
<option value=2>February</option>

Also the year drop down since 2003 value will be added with every year ie in 2004 it shd show:

<select name=year>
<option value=2003>2003</option>
<option value=2004>2004</option>
and so on..

Any help?

View 7 Replies View Related

Current Date Time Format "year-month-day Hr:min:sec"

I want the current date to be displayed in this format: year-month-day hr:min:sec

View 1 Replies View Related

Javascript - Week Year Day Dynamic Display?

Im writing a php script to generate dynamic days,weeks,months,years etc also tree structure javascript.I require something like this



View 1 Replies View Related

Get All Posts From The Same Month And Year For Sidebar Display?

The Wordpress blog I'm building is published like a magazine; the first day of every month, several (nine, to be exact) posts are published in rapid succession. When a reader views one of these nine posts, the other 8 posts should appear in the sidebar.

I have a function I've written to accomplish this, but I'm having some issues that I'll describe below. Here's the code:

function getSidebarPosts($post_id){
$ret = array();
$parent = get_post($post_id, ARRAY_A);
$sdate = strtotime($parent['post_date']);
$month = date('m',$sdate);


The parameter passed to this function is the ID of the post being displayed, so I need to retrieve all of the other posts published during the same month and year as the post being viewed. Wordpress doesn't generate any errors in any of this (nor does PHP, for that matter), but I simply get an empty result set and I'm unsure why that is. The code is fairly straightforward, but if I can clarify anything, do comment and let me know.

Oh, and I've tried adjusting the 'numberposts' parameter and that doesn't seem to have any effect. Also, each post has exactly one category.

View 1 Replies View Related

Displaying A MYSQL Display Set For A Year With Monthly Totals?

I have two tables, sales and costs, each with a costs fields, and a date field of type date.The rest of the fields are not relevant for what I want to do.I want to take the totals of each month, and display them together.I am unsure if most of this should be done in SQL, if it must be one or several queries, of if I must manipulate the data in PHP...

View 2 Replies View Related

Creating A Dashboard To Display Sales By Day, Week, Month, And Year ?

I'm trying to create a dashboard to tell me how much I've made last year, this year so far, overall in total, month, last month, week, and today. This is the coding i have so far..I cannt get day to work..it prints nothing, I havent even started on week (that looks scarey to code) as well as last year. So far overall sales, this month, and last month works.

$total_sales = $db->select('SELECT SUM(`prod_total`) as `total_sales` FROM `'.$config['dbprefix'].'CubeCart_order_sum` WHERE `status` > 1 ;');
$quick_stats['total_sales'] = $total_sales[0]['total_sales'];[code]....

How do I do day and week?

View 3 Replies View Related

Code To Display Students Name First And Last Class Year On Correct Date

I work at a UK Secondary School who want displayed on screens around the school students whos birthdays are today. From our school database its exports the students First Name, Last Name, Class Year, DOB (Format example 01 February 2010) display this information if i were to put it in to a MYSQL Database. I need a code to display the students name First & Last and their Class Year on the correct date.

View 5 Replies View Related

Select Records From Previous Year Starting On July 1st For Each Year?

I need to select all the records from the previous fiscal year (the fiscal starts on July 1st for each year). I searched the site and haven't found any posts with this requirement. I also tried [URL] and could see how to write it to do that.

I need something like:


SELECT * FROM table WHERE SignupDate<'the current year' . '-07-01'

View 2 Replies View Related

Loop From Today To One Year Later (one Year Date Range) ?

Possible Duplicates: PHP Day iterator

I have 2 dates in PHP, how can I run a foreach loop to go through all of those days? I want to create a loop which creates records for each day from today to one year later.There is no input for dates.From date which the form is submitted to the day 1 year after.

How can i do that ?For example today when i submit the form today, i need a loop from 17/01/2011 to 17/01/2012

View 2 Replies View Related

Check Week Number In End Of Year And Begiining Of New Year?

I am creating a little own calendar. Now I want to add a "previous week" and "next week" functionality to the calendar.

It is easy to take $thisWeek - 1; and $thisWeek + 1;, but there has to be a check wether it is the last week of the year and it should actually be a new year and head to week number 1. HOW do I make this kind of function? I use the following string names:


View 2 Replies View Related

Print All Weeks In Year Or First Monday Of Year?

How print all the weeks which start with monday and end with sunday.. like below ..using Zend_date

1 04-Jan-2010-10-Jan-2010
2 11-Jan-2010-17-Jan-2010
3 18-Jan-2010-24-Jan-2010

View 2 Replies View Related

Check Whether A Year Is Bisect (i.e. A Leap Year)?

How can I check whether a year is bisect (i.e. a leap year) in php ?

View 2 Replies View Related

Display The Current Time In PST

I want to display the current time in PST using php.

I want it to appear like this:
October 21st, 9:46 PM PST

but the closest I can figure out is this..

November 10, 15:36 PST

using this code...

View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved