Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:37:57+00:00 2026-06-01T15:37:57+00:00

We have a request from many customers to make our datepickers reflect the date

  • 0

We have a request from many customers to make our datepickers reflect the date format they have chosen to use in our app. Unfortunately, we use datepickers a lot, so going to each one and making sure that the date is still properly parsed is a last resort.

Right now I have translated the date format they chose into the corresponding date format for the datepicker, and simply set the default dateFormat to that.

<?php
// set default datepicker date format depending on their date format
$phpToJsDateFormats = array(
    'j M Y' => 'd M yy',
    'Y-m-d' => 'yy-mm-dd',
    'm-d-Y' => 'mm-dd-yy',
    'd-m-Y' => 'dd-mm-yy',
    'n/j/Y' => 'm/d/yy',
    'j/n/Y' => 'd/m/yy',
    'F jS, Y' => 'MM d, yy',
);
$jqueryDateFmt = $phpToJsDateFormats[ $settings['Config']['format_date'] ];
?>
<script type="text/javascript">
$.datepicker.setDefaults({
    dateFormat: "<?php echo $jqueryDateFmt ?>"
});
</script>

To make this a simple fix, I was wondering if there was a way I could mask the actual value of the datepicker so the value we show the user is in their date format, but the value the datepicker actually submits is the default format that we already use. I’m thinking of something along the lines of a global form onsubmit, and something similar for forms submitted via AJAX, but I don’t know. Maybe jQuery has something cool built into their datepicker that I don’t know about.

Any ideas would be greatly appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:37:58+00:00Added an answer on June 1, 2026 at 3:37 pm

    Use altFormat

    $( ".selector" ).datepicker({ altFormat: "yy-mm-dd" });
    

    This allows one date format to be shown to the user for selection
    purposes, while a different format is actually sent behind the scenes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to differentiate between an incoming request from an Iphone App and an
I have a php web service that takes the request from android/iphone app and
We've had an interesting request from a client. They'd like their users to have
I have a shared memory pool from which many different threads may request an
I have a request in from a client that would like one of their
I have a Filter Servlet that filters request from a Servlet. I do not
I need loging all HTTP request (from any application). I have Delphi 7.0. Anybody
I have a request for some contract work from an organization that uses Excel
I have web application of which major part is javascript. I request images from
I have an AJAX request to display a list of addresses from the users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.