Solved

How can I set the default time / date

Posted on 2012-03-20
3
360 Views
Last Modified: 2012-03-31
Hi,

I am using this AJAX time picker: http://www.ama3.com/anytime/#AnyTime.picker.ajaxOptions

I have 3 fields in my form, EventDate, StartTime, EndTime

Using this script, I want to set the date to the first of x month. Meaning, It's March 20 now, so the default date would be March 1 2012 in the picker. Now when it becomes April, it would be set to April 1 2012.

StartTime and EndTime I want to have set default at 12:00 AM for both.

How can I accomplish that?

Thanks
0
Comment
Question by:Computer Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Expert Comment

by:IanTh
ID: 37741444
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 37741553
I'm looking for the answer to the specific example i provided.
0
 
LVL 1

Accepted Solution

by:
haravallabhan earned 500 total points
ID: 37741831
Call this function at the end of the script or html page.
function firstDayOfMonth() {
    var yourDate= new Date();
    var firstDate= new Date(yourDate.getFullYear(), yourDate.getMonth() - 1, 1);
    document.myform.EventDate.value=AnyTime.format(firstDate);
}

myform is your form name and the EventDate is the name of your field. Similarly you can do it for the time as well. You can change  document.myform.EventDate.value t jQuery mode as $(#EventDate).value...
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem in javascript 17 58
Need help for active menu class depending of the page 4 29
Leaflet map example works but I want to make a change to it 5 28
Jquery syntax 12 29
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question