Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery Date picker jquery to UK format

Tags:

jquery

I am using the Jquery datepicker from the website to allow users to select date and was wondering if it would be possible for the displayed date to be shown is the UK format of the date for example 22nd September 2012 is shown in the uk as 22/09/2012 while in American format its 09/22/2012

like image 909
user2169717 Avatar asked Mar 18 '13 16:03

user2169717


People also ask

How do I change date format in date picker?

Do one of the following: For a text box control or a date picker control, ensure that the Data type list displays the appropriate data type, and then click Format. For an expression box control, ensure that the Format as list displays the appropriate data type, and then click Format.

How to change Format of datepicker in jQuery?

inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });

How do I change the Datepicker format in bootstrap?

In order to set the date format, we only need to add format of one argument and then we will add our required format, which is shown in the following example: Example 1: In this example, we are going to use dd-mm-yyyy format.

How do I change the date format from YYYY MM DD in jQuery?

Re: convert Date from YYYY-MM-DD to MM/DD/YYYY in jQuery/JavaScript. var tempDate = new Date("2021-09-21"); var formattedDate = [tempDate. getMonth() + 1, tempDate.


2 Answers

try this:

$('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' });

$.datepicker.formatDate( format, date, settings )

Format a date into a string value with a specified format.

The format can be combinations of the following:

d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
anything else - literal text
like image 94
ebram khalil Avatar answered Oct 27 '22 00:10

ebram khalil


Use one of the following

$('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' });

$('#datepicker').datepicker({ dateFormat: 'dd/mm/yy' });

$('#datepicker').datepicker({ dateFormat: 'dd-M-yy' });

$('#datepicker').datepicker({ dateFormat: 'dd-MM-yy' });

like image 34
Priyanthi Avatar answered Oct 27 '22 02:10

Priyanthi