Solved

How can I set the default time / date

Posted on 2012-03-20
3
356 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
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.
The viewer will learn how to dynamically set the form action using jQuery.
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.

756 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