?
Solved

How can I set the default time / date

Posted on 2012-03-20
3
Medium Priority
?
374 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 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 2000 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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
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…
Suggested Courses

719 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