Jquery Date Picker Validation - format issue

Hi ,
I am using 2 text items with Jquery dateicker for start date and end date items.
I have to now write a JS validation to ensure start date <= end date.
The dateformat of my items are 'd-M-yy' (02-Mar-2010) .....
When I try to use the Date.parse() function , it gives me an invalid date error....
If I change the date format to mm/dd/yy (03/02/2010) then there is no problem, I can use Date.parse() and compare the two dates, I get no error . However I need the date format to be : 02-Mar-2010
Below is a simple version of the JS function Iam using to compare dates and alert error
function f_validate()
var a = $v('P1_START_DATE');
var b = $v('P1_END_DATE');
var startDate = new Date();
var endDate = new Date();
startDate = Date.parse(a);
endDate = Date.parse(b);
// if I alert() startDate or endDate it says invalid date
if (startDate>endDate){
alert('error');
else
doSubmit();
} Has anybody done a similar validation with Jquery datepickers in the format 'd-M-yy' ?
Also how Can I use $.datepicker.parseDate function within my Javascript function so that I can convert the dates to the default format and then compare them....
Appreciate any ideas/pointers
Thanks,
Dippy
Edited by: Dippy on Mar 2, 2010 12:42 AM

I've used the following without problems:
   var gasDay = $v('P0_GAS_DAY');
   var gasDayDate = new Date();
   gasDayDate = $.datepicker.parseDate('dd-M-yy', gasDay,
      monthNamesShort : ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
   );

Similar Messages

  • Date Picker (Application Format Mask) YYYY-MM-DD HH24:MI

    I am experience what appears to be a bug with the Date Picker (Application Format Mask) that is causing the "DD" portion of the format mask to be interpreted as "CC" (when using a YYYY-MM-DD Application format).
    Within "Application Builder", "Edit Attributes" I have defined a "Static Substitution Strings" with the required Substitution String of PICK_DATE_FORMAT_MASK and a Substitution Value of "YYYY-MM-DD HH24:MI" (without the quotes).
    When this is used within the application, and I select a date of "January 15, 2008 @ 23:14", the date picker gives me a date of "2008-01-20 23:14". If I were to change the Year to 1957, the date I get is "1957-01-19 23:14". Note that if the century is 20, no matter what day of the month I pick, I get DD=20. If the century is 19, the day of the month is always 19.
    I have also tested this with a format of YYYY-DDD HH24:MI. With this format too, the DDD gets set to the century portion of the year.
    DD-MM-YYYY HH24:MI format does work, however this is not the format that my end users want to see. They want to see the format as "YYYY-MM-DD HH24:MI"
    If I change the PICK_DATE_FORMAT_MASK to "YY-MM-DD HH24:MI" and pick "Feb 8, 1977" I get "77-02-28" and if I pick "January 9, 1921" I get "21-01-31" which just happens to be the last day of the month in each of those case.
    So, something really weird is happen with the "Application Format Mask" Date Picker.
    Please note, that because of a known bug (relating to the translation of the Browser Language of "en-ca" to the propery NL_LANG of ENGLISH_CANADA) refer to
    HTMLDB - HOWTO Work with Dates
    I am executing the following code in my first "On Load - Before Header" and my first "On Submit - After Computations and Validations"
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT=''YYYY-MM-DD HH24:MI''' ;
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_SORT=''FRENCH''' ;
    Could you please investigate this problem.

    Paul,
    Thank you for the feedback and detailed reporting of this issue.
    This is a previously identified bug with the computation of the day component of the popup calendar.
    This correction will be available with the next HTML DB patch set and/or the release of HTML DB available later this year.
    Thanks again.
    Joel

  • Date picker validation

    Hello everyone,
    I need help on the following.
    i have date picker colum .I want a validation chk so that nobody can enter except MM/DD/YYYY) format and also nobody can cahnge the date

    Hello:
    Is the intent to prevent the user from entering a date directly into the text field ? If so, add the following to the 'HTML Form Element Attributes' of the Date Picker item
    onFocus="alert('You cannot enter data into this field directly');this.blur()"For your validation you could use a simple pl/sql block like
    declare
    l_date date;
    begin
    select to_date(:date_picker_item,'MM/DD/YYYY') into l_date from dual;
    return true;
    exception when others then
    return false;
    end;Varad

  • How to change date picker display format?

    Default display format is 01-JAN-09 for date picker.
    How can I change it to
    Jan 21, 2009
    Thank you.

    If you need use your format for all data pickers in your application you can set it via:
    Go to
    Shared components ->Definition->Globalization (Tab) -> Application Date Format SET to Mon DD,YYYY
    and in the item Display as set "Data Picker (use ppplication format mask)"
    If you need set format to some data picker you have to go to your data picker item and Display as set "Data Picker (use item format mask)"
    and
    Go to Source region in this item and set Format mask field Mon DD,YYYY

  • InfoPath Date Picker - Reversed formats for different users

    Two other users using an InfoPath 2010 form I have published onto SharePoint 2013 on an intranet both experience a mandatory date format of dd/mm/yyyy, whereas I experience mm/dd/yyyy. We are all using IE and have the same version (11.0.9600.17207) with
    the exception of one of the other users (10). Any solutions/possible causes of the problem?

    Hi Linna,
    Please collect information about regional setting in all PC machines’ control panel. InfoPath is client application that might be affected by local regional settings. Also provide the regional setting of your site.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Date Picker Error when not valid date

    I have a field with a date picker. I have an inline validation of type pl/sql error that checks to see that the user actually entered a valid date
    l_date := todate(:P1_MYDATE, '&PICK_DATE_FORMAT_MASK.');
    Works fine, except, next to the field (between the field and the date picker) I get this "junk"
    Unable to cast value "03/35/2004" to date format mask PICK_DATE_USING_FLOW_FORMAT_MASK
    This is pretty ugly, especially as I am already telling them they made a mistake.
    Would you like me to log a bug?
    Also . . . it would be great to have a built in validation for dates. Any thoughts there? Perhaps an enhancement request?
    Thanks,
    a-

    Anton,
    This is definitely pretty ugly and should be handled more gracefully. As it stands now, there is no way to suppress this automatic casting to a date value.
    You can work around it by clearing session state for that item if the validation fails. You could do this in a validation of type Function Returning Boolean with:
    declare
    l_date date;
    begin
    l_date := to_date(:P1_MYDATE,'&PICK_DATE_FORMAT_MASTK.');
    return true;
    exception
    when others then
    :P1_MYDATE := NULL;
    return false;
    end;
    The idea for a built-in validation for dates is a great one. HTML DB has all the information (what type of date picker, any format masks, NLS settings) to determine the validity of a date value.
    Joel

  • Dynamic Action On Date Picker

    Hi,
    I need help with understanding dynamic actions. I have two date pickers, I want the value of the first date picker to be the minimum date of the second date picker. To achieve this I have a hidden item whose value I want to reflect the selected date in the required format. In the dynamic action on the date picker I have no condition, and the true action is set to execute the following pl/sql code
    :P200220000_Y_MIN_DT := TO_CHAR(TO_DATE(:P200220000_Y_STR, 'DD-MON-YYYY'), 'YYYYMMDDHH24MI');. The items to submit field contains both the first date picker and the hidden item.
    The "P200220000_Y_MIN_DT" is now passed into the minimum date field of the second date picker. The problem is when the date is changed the hidden item does not get the value until the page is refreshed.
    Am I doing something wrong or just have not mastered the use of dynamic action or are my colleagues right use AJX call backs not dynamic actions.
    Thanks
    Aderemi

    Hi Aderemi,
    first of all as already explained, the min/max values are already used on the server side when the necessary code for the date picker is rendered. When you changed the referenced values in the browser, these values will not change the behavior of the client side date picker widget. But when you submit the page, the new min/max values will be used by the date picker validation check on the server.
    To over the client side date picker display issue, you could directly call the date picker JavaScript code and pass in the new min/max values. Have a look at http://jqueryui.com/demos/datepicker/
    So for example you could have a dynamic action of type "Execute JavaScript code" which executes the following Javascript code.
    apex.jQuery('#P200220000_MY_DATE_PICKER').datepicker("option", "minDate", "-1m");I think that should work. Note: I haven't tested if that really works and it's also some kind of unsupported, because it uses the underlaying jQueryUI APIs the APEX date picker is using. This could change in the future and would invalidate your code.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins

  • Date Picker Translate Help

    Hi
    We've been using jQuery date pickers long before APEX used them as standard so have our own way of implementing them, that being said it shouldn't have any effect on what I'm trying to do.
    I have an application (APEX 4.2.1) that is used in a number of different languages. We don't use the APEX date picker and instead display dates as text fields, add a specific class to them and attributes as required. The class is picked up in javascript and the field is converted to a jQuery UI date picker with the attributes controlling certain behaviour (date restrictions etc.) This works fine and the date picker is translated to the different languages without a problem.
    Now I have a page in which fields defined by the user are displayed along side APEX fields. To do this I'm using apex_item and generating items on the page based on settings controlled by the user in another part of the application. The APEX items are displayed followed by custom items using apex_item. Again, this works fine and I've used it many times before.
    The problem I have is when a user creates a custom field which is a date picker and the date picker is translated.
    If the user is viewing the page in Norwegian then for an APEX field the date picker is shown in Norwegian and if they select May 1st then 1-Mai-2013 is returned to the field. The value of this field is 1-Mai-2013 when the page is submitted, but somehow the value is saved in the database correctly and when the database is queried the date is saved as 01-MAY-2013. For a custom field the value is saved in the database as 1-Mai-2013 and when this is then viewed by a user in English the page errors with not a valid month.
    My questions are:
    - How does APEX save a translated date field? How does 1-Mai-2013 become a proper date? If I try to save this in the database, unsurprisingly I get an invalid month error.
    - How can I use apex_item to have a date picker that is translated? apex_item.date_popup can't be used as this doesn't use the jQuery date picker. Perhaps this is a setting in jQuery UI to translate the date back? One solution is to use dd/mm/yyyy format, but I really don't want to do this.
    Many thanks for your help. If you need any more info let me know.
    Sara

    Hi Mike
    Thanks for the reply. When I said that it's saved as 01-MAY-2013, I was aware that it wasn't actually saved as this and is stored as a date. My point was that as a user I had entered the text 1-Mai-2013 on the screen and somehow it was changed to a date which when queried in the database was returned correctly as 01-MAY-2013. Showing that somehow it had been translated correctly from Norwegian. Even if I were to save my custom field value in a date column in the database, I would get an error as it would be trying to insert 1-Mai-2013 into a date column which isn't of the correct format. I think the problem can be resolved if I can convert the text in my custom field into a date.
    I've been able to find a possible solution, but I'm having problems implementing this.
    If I run
    select to_date('03-Okt-2013','DD-Mon-YYYY','nls_date_language=NORWEGIAN') from dual;
    this returns the correct date in the correct format (03-OCT-2013), which could be saved in my table and the problem would be resolved. I know what language is being used in my APEX session so I've used the following code to my procedure:
              CASE V('FSP_LANGUAGE_PREFERENCE')
              WHEN 'no' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=NORWEGIAN');
              WHEN 'sv' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=SWEDISH');
              WHEN 'pl' THEN v_value := to_date(v_value,'DD-Mon-YYYY','nls_date_language=POLISH');
              ELSE v_value := to_date(v_value,'DD-Mon-YYYY');
              END CASE;
    I've tested this through SQL*Plus and it works perfectly. The dates are always converted from Norwegian to English (the default for the database) DD-MON-YYYY.
    However, when I run the same code through APEX it doesn't work. The date is still stored as Norwegian. If I enter 10-Mai-2013 in the field that is exactly what is stored in the database. I've even added debug to make sure it's running the right bit of code and it is.
    Why would this code work in SQL but not through an APEX session? And is there anything I can do to resolve this?!
    Many thanks
    Sara

  • Writing the value from an unbound Date picker field to a timestamp field.

    Hi,
    I am having a frustrating time trying to write the results of a date field to a Timestamp field in an oracle10 table in APEX 3.1. The Date Picker correctly returns 01-JUN-2008 23:59 into the date picker page item :P60_EXTENTION_DATE (As a varchar I believe).
    Using a plsql function similar to the following I am trying to write the date to a timestamp field eg.
    begin
    update customers set extention_date = :P60_EXTENTION_DATE where ROW_ID = 34;
    end;
    This without fail this gives me stupid errors it wants 2 digit years, it wants AM/PM.
    I have tried this:
    update customers set extention_date = to_date(:P60_EXTENTION_DATE) where ROW_ID = 34;
    and:
    update customers set extention_date = to_date(:P60_EXTENTION_DATE,'DD-MON-YYYY HH24:MI') where ROW_ID = 34;
    How can the date picker return a date that oracle "ORA-01821: date format not recognized" ? It just seems un-intuitive (fricken retarded) to me.
    I have tried about 30 combinations date picker, to_date formats etc. and it is driving me nuts, can someone please tell me which combination of date picker and to_date function I need to make this work.
    1 free internets to anyone who can help.
    Cheers
    Message was edited by:
    cl3ft typos

    Hello,
    >> …trying to write the results of a date field to a Timestamp field …
    can someone please tell me which combination of date picker and to_date function I need to make this work.
    If the target is a timestamp column, did you try to use the to_timestamp function? http://www.techonthenet.com/oracle/functions/to_timestamp.php .
    Regards,
    Arie.

  • Uk date format issue with ASP and Access Database

    I have an Asp form which updates records in an Access
    database. Problem is
    that the date format in the database record is dd/mm/yyyy
    (UK), when
    the record is displayed on the form it is mm/dd/yyyy(US)
    which after I
    update the record in the database the date has changed to the
    new format.
    I have tried everything I can to change the format but to no
    avail...anyone any ideas how I can resolve this issue?
    Thanks
    Steve

    stevo.s wrote:
    > Hi
    >
    > I have tried changing the format on the date field on
    the server behaviours
    > panelto ddmmyyy. Also have tried to set the form field
    format to ddmmyy. I have
    > also tried to use a function I got from a posting
    somehwere on the net to no
    > avail. <%function ddmmyyyy(varDate)
    > ddmmyyyy = Day(DateValue(varDate)) & "/" &
    Month(DateValue(varDate))
    > & "/" & Year(DateValue(varDate))
    > end function
    >
    > I believe that this is a recognised issue with
    Dreamweaver and Access but
    > can't seem to grasp the work around! Problem being I am
    teaching myself through
    > books and internet articles and can be weeks at a time
    without being able to
    > look at the issue..each time I come back to it it is
    like starting all over
    > again! I was hoping that somewhere out there there is a
    simple solution the
    > issue perhaps a date picker with the built in
    functionality to address the
    > issue...I am keen to understand how to deal with the
    issue rather than just
    > change my database date field to fudge the problem as I
    am in the UK and when I
    > eventually start to use the application I would like
    there to be some
    > consistency with dates and that users are familiar with
    the format.
    >
    > Any help gratefully received!
    Its not Dreamweaver, or Access, its your servers locale, its
    set to US
    format, not the UK.
    On your page at the top use:
    <% Session.LCID = 2057 %>
    This will force the page into using UK formatted dates. Use
    it on any
    page that needs to format the page correctly.
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

  • Apex 3.1 Upgrade Issue - dba_lock and date picker display

    A couple of minor issues I've seen with my upgrade from 3.0.1 to 3.1. Just wondered if anyone else has seen them and if anyone has a simple fix for the date picker problem :
    1. DBA_LOCK - the upgrade process itself complains about the SYS.DBA_LOCK view not existing - easily remedied by running catblock.sql before you start the upgrade (but not listed as a pre-req)
    2. DATE PICKER display - I have a date picker item in a navigation region - before the upgrade the calendar icon happily appeared directly to the right of the date cell, since the upgrade the icon has moved to underneath the cell, messing up the look and feel. (Also the size of the pop up calendar doesn't quite fit its contents now and you have to resize to see the close and ok buttons )
    Any confirmation that others can replicate the second issue or a quick fix would be very helpful.
    Many thanks,
    Rich.

    Rich,
    >> Unfortunate that something has changed between 3.0 and 3.1 then that will require us to change the formatting. Hopefully not too much work to sort out a form region that looks the same though.
    I know the templates were revised for APEX 3.1, but that should not have affected existing applications. So you're saying that application used a Navigation Template before just fine without issues? I'll ask Carl to investigate.
    >> The issue of the default size of the pop up window cutting off the buttons at the bottom still remains in your example however. (obviously users can resize it but not ideal)
    Well, that really sucks. The worst thing we can do is break the behavior of existing applications, and it appears we've done it here. I filed Bug 6864371 on this issue. We'll get it fixed in the very first patch set for APEX 3.1.
    Joel

  • Apex 4.2: Date picker & format mask number

    Hello
    In Apex 4.2, in a Date Item, how can I modify the date picker to set Monday as the start of week day? I can set Monday as the start of week day on a calendar, but not in a Date Item.
    In a Number Item, there's no format mask to set the comma char as a decimal separator and the dot char as a thousand separator. How can I create a new format mask number?
    Thank you.
    Edited by: user7034195 on 12-mar-2013 3:24

    for the Date Item, you can check this link, you have to call the process on the page load
    http://stackoverflow.com/questions/1313317/set-start-day-of-the-week-in-jquery-ui-datepicker
    and for the Number format, there's a little trick involved, will try to explain
    First of all convert you items from Number field to simple Textfield.
    1. Write this in your items Post Calculation Computation: TO_CHAR (:item_name, '999G999G999G999G990D00', 'NLS_NUMERIC_CHARACTERS = '',.''')This will do the number formatting you want, but in oracle above format is not acceptable, so while submitting the above values to database we need to undo the changes for that you can use the below code.
    2. Create a Computation "After Submit" for every item you did the above formatting and copy this code in it: replace(replace('1.00.00,00','.',''),',','.') for the 2nd step you can create a package/function which will get the items value as string and do the conversion as number using above code and return back the number.
    This should help you.
    Regards,
    Tauceef

  • Date Picker Format YYYYWW

    Hi,
    I need to make a calendar date picker return a date in
    YYYYWW format. I already tried to use an application format mask with no success. Any Ideas ?
    thanks in advance,
    pedro

    please feel free to tell us specifically what "no success" means for you. i'm able to have my datepickers return YYYYWW values w/o issues. if you're using your datepicker in an update form, though, know that your WW format code will cause problems there. when you use a datepicker item, it's doing a to_date on your value at one point. if that value contains a WW format date value in there you'll hit a ORA-01820. it's the same error you'd get if you did a select to_date('200426','YYYYWW') from dual. anyhow, datepickers using the application format mask, PICK_DATE_FORMAT_MASK, do support 'YYYYWW' format masks, but they won't work on update forms. i'll log an enhancement request for us to help with avoiding that issue for updates, but if your issue involves something else about using PICK_DATE_FORMAT_MASK, please do let us know.
    regards,
    raj

  • How to programmatically set formatted javascript dates for validation?

    How does one programmatically set formatted javascript dates for validation?
    "12/31/2011" does not seem to work?

    ourDate.rawValue = "2011-12-31";  // works
    NOTE:  if you have a hierarchy issue you may need something like
    root.body.table.detail.ourDate.rawValue = "2011-12-31";

  • Pages is not saving document correctly.  After saving the changes either do not appear or you can not open the file. The error is "not a valid format"  I am in Pages '09 4.1 (923).  I also use Parallels.  Anyone having similar issues?

    Pages is not saving document correctly.  After saving the changes either do not appear or you can not open the file. The error is "not a valid format"  I am in Pages '09 4.1 (923).  I also use Parallels.  Anyone having similar issues?

    I'm not sure that Lion AutoSave feature apply to network servers.
    I'm just sure that the Versions feature doesn't.
    Yvan KOENIG (VALLAURIS, France) samedi 21 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k
    My iDisk is : http://public.me.com/koenigyvan

Maybe you are looking for

  • Using the function SUM() in a calculated Key Figure

    Hi All, I need to create a calculated Key Figure and am looking for the function SUM().Can you please let me know where this is present.I have checked under the "Data Functions" and it does not seem to be present there. Thanks Aravind Pattabiraman

  • Resetting play order for imported MP3s

    On several occasions I have imported compilation MP3s ripped on other computers into iTunes, only to find that the files play in the order of artist. They have Track numbers in the ID3 tags, which iTunes recognized, but I cannot get them to consisten

  • ASP & Clob fields in the Oracle Database 8i

    Hi All, This is the first time I am posting a question. We are having a problem interfacing ASP pages with Clob fields int he Oracle Database. We are trying to display clob fields in an oracle database from ASP PAge. The ASP Page does a select to a c

  • Mouse flickering

    My mousecursor is flickering when i go over a canvas3D. Can i solve this problem? thanx

  • Running in 64-bit mode

    Will running my MBP in 64-bit mode (holding 6 & 4 during boot) give me less battery life on a charge? If so, approximately by how much? I'm considering running my Mac Pro in 64-nit mode permanently but can't decide on my MBP based on this question. T