我正在尝试使用jquery ui datepicker获取具有以下格式的日期:d de MM de yy。示例:8 de Enero de 2016
我试过: dateFormat:'d \ de MM \ de yy' dateFormat:'d'de'MM'de'yy' 但它没有像我预期的那样工作,它显示了8 8e Enero 8e 2016而不是8 de Enero de 2016。 我在下面的小提琴中有代码:http://jsfiddle.net/yewnu9jL/1/
<input type="text" id="datepicker">
$(function(){
$.datepicker.regional["es"] = {
closeText: "Cerrar",
prevText: "<Ant",
nextText: "Sig>",
currentText: "Hoy",
monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthNamesShort: ["Ene","Feb","Mar","Abr", "May","Jun","Jul","Ago","Sep", "Oct","Nov","Dic"],
dayNames: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
dayNamesShort: ["Dom","Lun","Mar","Mié","Juv","Vie","Sáb"],
dayNamesMin: ["Do","Lu","Ma","Mi","Ju","Vi","Sá"],
weekHeader: "Sm",
dateFormat: "dd/mm/yy",
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ""
};
$.datepicker.setDefaults($.datepicker.regional["es"]);
$('#datepicker').datepicker({
dateFormat: 'd de MM de yy',
maxDate: 0,
onSelect: function() {
$('#form-fecha').submit();
}
}).datepicker('setDate', new Date());
});
我该怎么做?
答案 0 :(得分:2)
最简单的方法是使用单引号引用文本...但为了尽可能简单地执行此操作,您应该使用 double 引号作为整体值:
dateFormat: "d 'de' MM 'de' yy"
答案 1 :(得分:0)
最后我解决了它:
byte[] buff = new byte[4096];
String str = new String(buff, "UTF-8");
do {
if ( buff[0] == 46 ) { //46-[.]
System.out.println("46-[.] " + buff[0]);
//incoming.getInputStream().read(buff);
}
incoming.getInputStream().read(buff);
} while ((buff[0] != 27) && (!done));