Title: Use php date format function in jQuery datepicker
Last modified: August 30, 2016

---

# Use php date format function in jQuery datepicker

 *  Resolved [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/)
 * Hi there,
 * This is my datepicker code:
 *     ```
       jQuery(document).ready(function ($) {
       	$( "#date" ).datepicker({dateFormat: "dd-mm-yy"});
       });
       ```
   
 * As you can see I have hardcoded the date format.
 * For my frontend code I use this to get date format set in WP Dashboard > Settings
   > General:
 *     ```
       date_i18n( get_option( 'date_format' ), $date );
       ```
   
 * Is it somehow possible to add this to the js datepicker file too?
 * Guido

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/#post-6453186)
 * When I look at the [jquery date formats](https://api.jqueryui.com/datepicker/#utility-formatDate)
   I guess this wil not work because dateformat in WP can be different.. For example,
   WP dateformat j F Y will not work in jquery.
 * Guido
 *  [cusserman](https://wordpress.org/support/users/cusserman/)
 * (@cusserman)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/#post-6453454)
 * Guido,
    I’m a python guy…and a few weeks new to WP. Where did you put your original
   date picker code in your first post? My theme is pulling d/m/Y. I want it to 
   be m-d-y.
 * Appreciate your assistance in advance.
    Chris.
 *  Thread Starter [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/#post-6453455)
 * Hi Chris,
 * There should be a JS file somewhere, in my case you can check the workaround 
   in the FAQ of my plugin [VSEL](https://wordpress.org/plugins/very-simple-event-list/faq/).
 * Guido
 *  Thread Starter [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/#post-6453459)
 * A late response… but it’s possible using [wp localize script](https://codex.wordpress.org/Function_Reference/wp_localize_script)
   and add the date variable there (see example on that page).
 * Resolved.
 * Guido

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Use php date format function in jQuery datepicker’ is closed to new replies.

## Tags

 * [date format](https://wordpress.org/support/topic-tag/date-format/)
 * [dateformat](https://wordpress.org/support/topic-tag/dateformat/)
 * [datepicker](https://wordpress.org/support/topic-tag/datepicker/)

 * 4 replies
 * 2 participants
 * Last reply from: [Guido](https://wordpress.org/support/users/guido07111975/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/use-php-date-format-function-in-jquery-datepicker/#post-6453459)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
