简体   繁体   中英

how to changing year date picker value range to 1320:1396

can you please help.how can I change date picker value change to 1320 to 1396?

here that part code:

(right now year range is 1902:2017 , but i want change this range to 1320:1396)

for ( $i = date('Y', time()-60*60*24); $i > 1901; $i-- ) {
                    $html .= sprintf( '<option value="%1$s" %2$s>%3$s</option>', (int) $i, selected( $year, $i, false ), (int) $i );
                }
            break;

I assume the function selected() compares $year to $i and if so, adds selected to the option.

In this case I don't think you'll have to do anything fancy with date. I think you can just transform the for loop to this:

for ($i = 1396; $i >= 1320; $i--) {

I'm not sure how it fits into the rest of your code, but this loops i from 1396 to 1320.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM