Date in javascript or jquery
How can i get the 'DD-MON-YYYY'(12-JUN-2011) DATE FORMAT IN JQUERY.
MY CODE IS
<SCRIPT type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker({
showOn: "both",
buttonImage: "#IMAGE_PREFIX#asfdcldr.gif",
buttonImageOnly: true,
dateFormat: 'DD-MON-YYYY'
</script>when i am using dateFormat: 'DD-MON-YYYY' then it showing like Thursday-JunON-YYYY date i want 'FORMAT LIKE '12-JUN-2011' How can i get this.
Please Help me to solve this problem.
Hi Vedant,
You are using a wrong format string, in jQuery they seem to be a bit different from what we would expect. The format string you have to use (according to the jQuery datepicker documentation) to get the date in the format you need is the following:
'dd-M-yy'Regards,
Sergio
Similar Messages
-
How to compare dates using javascript?
Hi,
I have to compare dates using javascript. The dates are in format "mm/dd/yy" for eg "10/09/06".
I have written a script to compare the dates but the problem I 'm facing is with the year.
For example if I compare "10/09/06" with "10/04/98", then "10/04/98" is coming out to be greater than "10/09/06" because it is considering year "98" to be greater than "06".
Please advice/suggest.
Thanks in advance...Dude, you're here in a Java forum, not in a Javascript forum. Those are two entirely different languages.
The answer in Java is to use java.text.SimpleDateFormat to convert String to Date and use java.util.Date and/or java.util.Calendar to compare dates. -
Passing data from JAVASCRIPT to SAP database
Hi Experts,
Is it possible to connect or access RFC function module through JAVASCRIPT? I want to send data from JAVASCRIPT to SAP database table.
Is it possible to pass data from JAVASCRIPT to SAP database table?
Thanks in advance.
Regards,
Arindam Samanta.OData services can be one option to achieve this.
Another possibility can be use of Generic REST enablement with SAP NetWeaver Gateway.
If you are not considering Gateway at all, then A JSON adapter like the one mentioned in JSON Adapter for ABAP Function Modules can be handy. -
How to create table with javascript and jquery in abap
Hello masters,
i want to create table using javascript and jquery.
i know how to use these languages but i dont how to implement them to abap.
regards.Look at the sample BSP application SBSPEXT_HTMLB
also you can look at the below Blog..
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
<i>*Reward each useful answer</i>
Raja T -
Refresh Crystal Report Viewer By JavaScript or JQuery
hii every body here ...
i need to can refresh the crystal report viewer with javascript or jquery as like [refresh button] on toolbar
so i need to do that without using standard refresh button on toolbar or by server side code only by java script code is this possible or not
thanks for the repliers ...thanks for replay my best friend but i need the below :
i using asp.net web application with crystal report 13
i use crystal report viewer on web page so ...
when i display the report some button inside the crystal report viewer toolbar like [refresh] button
i need to click this button by javascript/jquery becuase i will fire it on page_load from jquery
when page load from javascript [client side] i will fire the refresh button ....
soo if this an soluation can let me do this task or not
remember that : i dont need to refresh the report from server side methods .
thanks alot -
The question says it all:
What Are The Minimum Permissions In Order An User To Be Able To Access User Profile Data With JavaScript And REST API.?
In the User Profile -> Permissions there is only the option for "Full Control".Hi Nikolay,
Thanks for posting your issue, you need to set permissions on User Profiles = Read. Kindly find the below mentioned URLs to get the code and more details on this.
http://www.vrdmn.com/2013/02/sharepoint-2013-working-with-user.html
http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
http://sharepoint.stackexchange.com/questions/61714/sharepoint-2013-call-the-rest-api-from-sharepoint-hosted-app
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/04/09/how-to-query-sharepoint-2013-using-rest-and-javascript.aspx
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
Detect end of last slide with JavaScript or JQuery (HTML5)
Is there any way to detect when the last slide has completed playing, using JavaScript or JQuery?
I am publishing as HTML5, if that matters.Is there any way to detect when the last slide has completed playing, using JavaScript or JQuery?
I am publishing as HTML5, if that matters. -
Transport data from Javascript file to BSP application
Hi,
How can we transport data from Javascript file that is stored in MIME repository to the BSP application that uses this Javascript?
To elaborate :
I have a BSP application which calls few functions from a Javascript file that is stored in the MIME repository. Now, i need to pass one of the values that is obtained dynamically in the Javascript function to the BSP application inorder to store it in DB.. How can I do this?
Thanks,
VasukiHi,
you must only identify in which variable the javascript function stores the values. So you can enrich
your bsp application with such a function. Then you must transfer the value to a hidden input field.
This field content can be requested via request->get_form_field( 'name_of_the_field' ).
On the other side, check out, if ther is a getter function in this library.
Use firwefox with firbug plugin an set breakpoint in the javascript function to get an overview about the dom modcel.
Best regards, Stefan -
I built a tinyStickyNotes App and works in PC browsers, how convert to mobile...eg apply touch where as exist click event(mainly for javascript or jQuery, well needed develop two versions of my App mobi/PC?)?
Really needed this or phone gap do the job?
a phone gap book includes what needed change (in this case) or look for a ...?... Book?
Also, not needed registered as phone gap user 9.99/mo if I am adobe creative cloud member, that's correct? yes correct / no needed
Cloud file drive(file explorer win or mac), may installed and in my computers not have creative cloud apps on them?absolutely. Being that there will be no touch events via the mouse and mouse events via the touch screen, the two should not conflict with one another. In the future css specifications, there will be something called touch points which will handle the events no matter the input.
-
How to convert html table with all its css properties into excel , by javascript or jQuery
hi,
<script type="text/javascript">
//working java script
function CreateExcelSheet()
var x = Table1.rows
var xls = new ActiveXObject("Excel.Application")
xls.Workbooks.Add
for (i = 0; i < x.length; i++) {
var y = x[i].cells
for (j = 0; j < y.length; j++) {
xls.Cells(i + 1, j + 1).Value = y[j].innerText
} xls.visible = true
function write_to_excel()
str = "";
debugger;
var mytable = document.getElementsByTagName("table")[0];
var rowCount = mytable.rows.length;
var colCount = mytable.getElementsByTagName("tr")[0].getElementsByTagName("td").length;
var ExcelApp = new ActiveXObject("Excel.Application");
var ExcelSheet = new ActiveXObject("Excel.Sheet");
debugger;
ExcelSheet.Application.Visible = true;
for (var i = 0; i < rowCount; i++)
for (var j = 0; j < colCount; j++)
str = mytable.getElementsByTagName("tr")[i].getElementsByTagName("td")[j].innerText;
ExcelSheet.ActiveSheet.Cells(i + 1, j + 1).Value = str;
//new funtion
function ExportToExcel(mytblId) {
debugger;
var htmltable = document.getElementById('Table1');
var html = htmltable.innerHTML;
window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));
//new funtion 2
function write_to_excel2() {
str = "";
debugger;
var mytable = document.getElementById("Table1");
var rowCount = mytable.rows.length;
var colCount = mytable.getElementsByTagName("tr")[0].getElementsByTagName("th").length;
var ExcelApp = new ActiveXObject("Excel.Application");
var ExcelSheet = new ActiveXObject("Excel.Sheet");
//ExcelSheet.Application.Visible = true;
for (var i = 0; i < rowCount; i++)
for (var j = 0; j < colCount; j++)
debugger;
// if (i == 0) {
// str = mytable.getElementsByTagName("tr")[i].getElementsByTagName("th")[j].innerText;
str = mytable.getElementsByTagName("tr")[i].getElementsByTagName("td")[j].innerText;
ExcelSheet.ActiveSheet.Cells(i + 1, j + 1).Value = str;
ExcelSheet.autofit;
ExcelSheet.Application.Visible = true;
DisplayAlerts = true;
CollectGarbage();
//csss
function excelExportHtml(Table1, css1)
debugger;
if (css1) {
var styles = [];
//grab all styles defined on the page
$("style").each(function(index, domEle) {
styles.push($(domEle).html());
//grab all styles referenced by stylesheet links on the page
var ajaxCalls = [];
$("[rel=stylesheet]").each(function() {
ajaxCalls.push($.get(this.href, '', function(data) {
styles.push(data);
return $.when.apply(null, ajaxCalls)
.then(function() {
return "<html><style type='text/css'>" + styles.join("\n") + "</style>\n" + table.outerHTML + "</html>";
else {
return $.when({ owcHtml: Table1.outerHTML })
.then(function(result) {
return "<html>" + result.owcHtml + "</html>";
//new
function ExportToExcel() {
$(document).ready(function() {
$("#btnExport").click(function(e) {
window.open('data:application/vnd.ms-excel,' + $('#Table1').html());
alert("jhhklhhklhklh");
//new
$(document).ready(function() {
debugger;
$("[id$=myButtonControlID]").click(function(e) {
window.open('data:application/vnd.ms-excel,' + $('div[id$=divTableDataHolder]').html());
e.preventDefault();
alert("k");
function excel()
{debugger;
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
return function(table, name) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }
window.location.href = uri + base64(format(template, ctx))
</script>
i have tried all the above java script and jquery to convert an html table to excel, data are exporting correctly but i want that css of the table should also implent to excel thats not happening,even the property defined inside td and tr aare not implementing
in excelHi avinashk89,
Welcome to post in MSDN forums.
This is not the right forum for your question. Please post in
ASP.NET forums where you could get better support.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to dynamically create a treeview in sharepoint using javascript or jquery
How to dynamically create a treeview in sharepoint using javascript that displays spsites ,spweb,splist
Hi,
In SharePoint 2010, we can customize web service and use Server Object Model to get all the SharePoint sites, webs and lists, then call the web service using jQuery and using the jQuery Treeview plugin to display the data.
The following articles for your reference:
Walkthrough: Creating a Custom ASP.NET Web Service
https://msdn.microsoft.com/en-us/library/office/ms464040%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
Using Jquery to call an ASMX service in sharepoint 2010
http://stackoverflow.com/questions/9035539/using-jquery-to-call-an-asmx-service-in-sharepoint-2010
jQuery-ui Treeview
https://plugins.jquery.com/btechcotree/
Best Regards,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Hide show button and textual area via Javascript or jQuery
Hi folks am Apex newbie using 4.0.1 on Vista laptop running OracleXE (for dev purposes)
A quick desc of what items are on the page of my Helpdesk appkication and what I want to achieve ..
I have a Progress region defined on the page - with textual areas and some region buttons.
Details are have 2 textual areas in my region - 1st textual area shows current progress (this is read only).
Second textual region is where IT person will type latest progress on Helpdesk prob (ticket).
There is a region button Save Progress Text which when pressed will append text from textual area 2 into textual area 1 and
also appends text e.g date / time / userid etc of progress text added.
This all works fine.
Have added a new region button - call it Enter Progress Text - which I would like when pressed will make textual area 2 and the Save Progress Text buttons visible.
I can hide and show the textual area 2 via $X_show / hide but cannot for life of me hide the Save Progress Text button.
I also tried to make a subregion holding textual area 2 and the Svae Progress Text button but again via Javascript / jQuery could not hide the subregion.
Can someone please tell me the syntax of how to hide via Javascript / jquery as can't find anything much at all in the Apex online documentation.
Many, many thanks as always.
P.S Don't want to use dynamic actions or hide / show region as want there to be buttons on screen to make things explicit for user hence my desire to use Javascript.
WiggywigHi,
If its a page item then you can use below script to hide it.
<script type="text/javascript">
$x_HideItemRow('Put your item name');
</script>*Put this code in page footer.. -
Calculating and Displaying Dates in Javascript
Hello,
I'm working on a flowchart form for my work, and am having issues getting a date to a) add correctly and b) display only certain portions of the date.
I have four fields:
CurrentDate - Displays the Current Date in MM/DD/YYYY format
DropDownList1 - Contains a list of projects end users can choose from
TextField1 - Displays text that tells the end user how many days the proejct will take
DateField1 - Should add the CurrentDate + the Number of days the project will take and return a new date in the same MM/DD/YYYY format
*Disclaimer* - I am not very experienced with scripting, and chose to go with JavaScript as I do have some previous past experience.
Here is what I have for my code right now:
if (DropDownList1.rawValue == 1){
TextField1.rawValue = "2 Days";
var AddDate = (Date.valueOf(CurrentDate) + (2*1000*60*60*24));
DateField1.formattedValue = Date(AddDate);
else if (DropDownList1.rawValue == 2){
TextField1.rawValue = "1 Day";
else if (DropDownList1.rawValue == 3){
TextField1.rawValue = "2 Days";
else if (DropDownList1.rawValue == 4){
TextField1.rawValue = "2 Days";
else if (DropDownList1.rawValue == 5){
TextField1.rawValue = "4 Days";
else if (DropDownList1.rawValue == 6){
TextField1.rawValue = "5 Days";
else if (DropDownList1.rawValue == 7){
TextField1.rawValue = "4 Day";
The end result is that the TextField1 displays the correct day, but the DateField1 displays a long string of the exact time and date of... well, the time - so no adding takes place. What I need is for the date to be displayed as MM/DD/YYYY. What am I doing wrong? I've only added the calculation to the first "if" statement, and will continue on to the rest once it is functioning.The following code will work in a LiveCycle Designer button using the "JavaScript" language option:
var oNow = new Date(); // get date time object
console.show(); // oepn and clear the JavaScript console
console.clear();
console.println("oNow = " + oNow);
console.println("oNow.getFullYear() = " + oNow.getFullYear());
console.println("oNow.getMonth() = " + oNow.getMonth());
console.println("oNow.getDate() = " + oNow.getDate());
console.println("oNow.getDay() = " + oNow.getDay());
console.println("oNow.getHours() = " + oNow.getHours());
console.println("oNow.getMinutes() = " + oNow.getMinutes());
console.println("oNow.getSeconds() = " + oNow.getSeconds());
console.println("oNow.getTimezoneOffset() = " + oNow.getTimezoneOffset());
The following script uses FormCalc and can be used with a button for testing:
var oDate = Date() // get today's date
var Year = Num2Date(oDate, "YYYY") // get year four digits
var Month = Num2Date(oDate, "MM") // get month 2 digits with leading zero
var Date = Num2Date(oDate, "D") // get date without leading zero
xfa.host.messageBox( Concat("oDate: ", oDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) )
var MyDate = "Feb 23, 2008" // a string data
var Year = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "YY" ) // 2 digit year
var Month = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "M" ) // month without leading zero
var Date = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "DD" ) // day with leading zero
xfa.host.messageBox( Concat("MyDate: ", MyDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) ) -
Is there any way to get Browser Laguage in javascript or jquery
Hi ,
I want current Browser language in sharepoint variation page using jquery or javascript, but the problem is navigator.browserLanguage is always returning en-us, even i selected different language in browser.
Issue coming only in IE. in firefox navigator.language is returning correct browser language.
As i am working SharePoint variation page and also used _spPageContextInfo.currentUICultureName property and it is giving variation page language not browser selected language.
Please help me on this, i already spend lots of time in this.
Thanks,
DineshHi,
Try using,
navigator.userLanguage
Hope it helps!
Thanks,
Avni Bhatt
If this helped you resolve your issue, please mark it Answered -
Short Date Validation Javascript
For those of you who use the nls_date_format = MM/DD/YYYY date format and want the same functionality for validation as isDate found in 9iAS, here is a function that you can use. It works in WebDB 2.2 as well. It checks for a valid date, including leap year adjustments, and allows for "short" short dates: if just the month and day are entered, a year assumption is inserted. Two digit years are corrected to four digit years with an assumption as well. Any date separator syntax is allowed as well, for example if you prefer dots (.) or dashes (-). Try it - pretty much any date that is "close" is corrected to the proper format. Here it is:
function isUSShortDate(e){
tda =new Array(31,28,31,30,31,30,31,31,30,31,30,31);
v=e.value;if (v==""){return true}
r= new RegExp("\[^0-9\/]","g");v=v.replace(r,"/");
a=v.indexOf("/",0);b=v.indexOf("/",a+1);
ndd=new Date();nfn=ndd.getFullYear();nfs=nfn.toString()
if (a==-1){err(e);return false}
else{ims=v.substr(0,a);
if (ims.length>2){err(e);return false};
if (ims.length==2){rms=ims};
if (ims.length==1){rms="0"+ims};
if (b==-1){l=v.length-a-1}else{l=b-a-1}
ids=v.substr(a+1,l);
if (ids.length>2){err(e);return false}
if (ids.length==2){rds=ids}}
if (ids.length==1){rds="0"+ids}
if (b!=-1){iys=v.substr(b+1);
if ((iys.length!=2)&&(iys.length!=4)){
err(e);return false}
if (iys.length==2){
iyn=Number(iys);ncn=Number(nfs.substr(0,2))
if(iyn>(50+nfn-2000)){ncn=ncn-1}
rcs=ncn.toString();rys=iys}
if (iys.length==4){
rcs=iys.substr(0,2);rys=iys.substr(2,2)}}
else{rcs=nfs.substr(0,2);rys=nfs.substr(2,2);
tfn=new Date(rms+"/"+rds+"/"+rcs+rys);
x=1.5768E10;diff=tfn.valueOf()-ndd.valueOf();
if(diff>x){tfn=nfn-1;tfs=tfn.toString();
rcs=tfs.substr(0,2);rys=tfs.substr(2,2)}
if(diff<-x){tfn=nfn+1;tfs=tfn.toString();
rcs=tfs.substr(0,2);rys=tfs.substr(2,2)}}
rfs=rcs+rys;rfn=Number(rfs);
if((rfn%4==0 && rfn%100!=0)| |(rfn%400==0)){tda[1]=29}
rdn=Number(rds);rmn=Number(rms);
if ((rdn<1)| |(rdn>tda[rmn-1])){err(e);return false}
if ((rmn<1)| |(rmn>12)){err(e);return false}
e.value=rms+"/"+rds+"/"+rcs+rys;
return true;
function err(e){e.value="Invalid";e.focus();e.select()}From this page:
http://www.webdeveloper.com/forum/archive/index.php/t-61259.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta name="Content-Script-Type"
content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>
<script type="text/javascript">
<!--
function check (f) {
var start = new Date (f.start.value);
var end = new Date (f.end.value);
start.setDate (start.getDate());
if (end >= start) {
alert ('Date 2 cannot be after Date 1');
return false;
// -->
</script>
<style type="text/css">
<!--
fieldset {padding:1ex; width:10em}
label {display:block; margin:1em 0}
input {display:block}
button {display:block; margin:auto}
-->
</style>
</head>
<body>
<form action="some-script.pl" onsubmit="return
check(this)">
<fieldset>
<legend>Dates</legend>
<label>Start Date<input name="start"
onchange="this.value = new Date
(this.value).toDateString()" type="text"></label>
<label>End Date<input name="end"
onchange="this.value = new Date
(this.value).toDateString()" type="text"></label>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com
"jenn" <[email protected]> wrote in message
news:fva0ov$eqj$[email protected]..
> Hello,
> I have form with two date fields. The default for the
date 1 is the
> current
> date. Date 2 cannot be after date 1. Does anyone know of
a javascript
> that
> would validate this on the client side. I don't want
them to be allowed
> to hit
> submit if they don't the right date for date 2.
>
> Thanks for your help.
>
Maybe you are looking for
-
Print Preview of Out bound delivery is not available in VL71
Hi Experts, I have created Outbound delivery with VL10B (against Purchase Order) and also set up output parameter in VL02N (Extra->elivery output -> Header) Now I want to take Print out of this Outbound delivey in VL71 , I c
-
Reminder needed: how to set password protection for all uses of computer
It's been a long time coming, but I feel that I need to limit the access to all materials on a Mac running OS 9.2. Is there a simple way that I can password protect the whole computer? Thanks for your time - and stay cool!
-
Can't find my iTunes library after transferring it from Windows to Mac
Hi! I've followed all the steps to transfer my iTunes library from an HP laptop with Windows XP to a MacBook Air using the Windows Migration Assistant, but when the process is finished (after waiting for more than 8 hours), I can't find where the lib
-
Hi, AVK does not check include jsp files <jsp:include any clues?
-
Skype won't accept my password
Dear all, I don't understand why but Skype keeps on refusing my password. I'm 100% positive sure it's the correct one : I tried to reset it several times, I tried to connect to the Skype website with success. I tried with both my user name and with m