Problem with Date/Time field in Adobe LiveCycle

I am trying to create a form that has a check-in and check-out dates. I want the user to enter those dates and then have the form automatically compute how many nights the user intends on staying.
I have two fields, CHECKIN and CHECKOUT, set up as text fields. My third field, NIGHTS, has the following script to do the calculation:
var strStart = CHECKIN.rawValue
var strEnd = CHECKOUT.rawValue
if(strStart.length && strEnd.length)
var dateStart = util.scand("mmm d, yyyy",strStart);
var dateEnd = util.scand("mmm d, yyyy",strEnd);
var diff = dateEnd.getTime() - dateStart.getTime();
var oneDay = 24 * 60 * 60 * 1000;
var days = Math.floor(diff/oneDay);
this.rawValue = days;
else
this.rawValue = 0;
NOW...this is fine if the user inputs a four-digit year. If not, it's trouble. SO, what I want to do is change the CHECKIN and CHECKOUT fields to the date/time field so they select the date off the pop-up calendar.
When I make the changes, I can't get the script to work for the NIGHTS field.
CAN ANYONE HELP THIS NEWBIE?

Make sure the format of the date strings provided by the calendar is what you are expecting. Or use the "formattedValue" for the input strings.

Similar Messages

  • How to compare Date in the TextField or DateTime with Date/Time field?

    Hi All,
    I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
    My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
    The functionality of my form is:
    I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
    In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
    I have tried using Num2Date and Date2Num with "YYYY-MM-DD"  format to compare but not succeed!
    Can you guys help me in this? Thanks in advance
    Regards.

    Hi,
    Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
    Here is the code which I am assigning the value:
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
    Do I need to change the format while assigning value in text box?
    You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
    Regards.

  • Help with Date/Time Field

    Hi,
    I'm very new at using Adobe LiveCycle Designer 7.0. For the past little while I've been using it to create a bunch of interactive forms. The only problem I've run into so far is a date and time stamp I've put in that is a Calculated - Read Only field. Only users with Adobe Reader and Professional can see this field. All other users with Adobe Standard can not see this field. Has anyone run into this same problem and know what I'm doing wrong?
    The field is using a Runtime Property for the current date and time, instead of a Calculation Script

    Thanks Niall,
    The format of date and time is fine. When I open the file up myself (in Adobe Professional, not Designer), the form looks great and when others who only have Reader can also see this form fine. For some reason, it's only people with Adobe Standard that don't see this field and this field only in the form. Btw, we are all running Adobe 7.0 currently, but have plans in the future (hopefully soon) to upgrade.
    Thanks again.
    Rowena

  • SQL Toolkit -- problem searching Date/Time field in Access

    I have got an application where I need to query a database (Access) between
    two dates (usually the same date, a couple of hours apart). I have set up
    the date field within Access as a 'General Date' but can't seem to get the
    right format on the SQL query. I am always getting some error. I enclose
    the date with {}, '', [], and () (and anything else I can think of) and I
    still get a problem. It is now to the point where I think it might be a
    problem with SQL Toolkit and Access working together.
    I tried making the Date field into a string field (instead of a Date field),
    but I can't search between time (I can search between dates, but not date
    and time i.e. MM/DD/YY 00:00:00).
    Any ideas?

    Sorry, the database type is Access.
    I just tried the following query SELECT * FROM ValveMeritData WHERE MeritTestDateTime >= '2006/05/01 13:24:28'
    and SELECT * FROM ValveMeritData WHERE MeritTestDateTime >= '2006/05/01'  (which gave a data mismatch error).
    I am going to try the query in access now.  I had pretty good success with other types of queries, just writing them in
    Labview and testing.
    Any other suggestions?

  • Problem with Date & Time Auto Update

    Hi everyone,
    I have been experiencing a date & time issue with my MacBook Air. (I am running 10.5.5 with all the latest software updates except for iTunes 8). Here's what's going on:
    Under the Date & Time preferences, whenever I try to check the box for "Set date & time automatically", the date and time do not update. I thought Norton might be the culprit in this case, but I have thoroughly uninstalled it, and this problem still persists. (I am actually borrowing this laptop for work, so I don't know if someone else possibly did something weird to it before I started using it. As far as I can remember, I've always had this problem -- the automatic setting has never worked.)
    I am connected to the internet when I do this, and I already have my time zone selected. Am I missing something obvious here?
    I apologize if this issue has been brought up before, but I did a lot of searching and couldn't find anything. Any suggestions would be greatly appreciated!!
    Thank you.

    whenever I try to check the box for "Set date & time automatically"
    You check it and the time does not update, or you try to check it and it doesn't show a little tick mark?
    Try it with Console.app open and see does it report any errors. Try changing the time server.
    AK

  • Problem with Date / Time Title - Showing Inacurate Information

    I use iMovie to make videos for my job. The videos need to have an accurate running time and date displayed on them. I use the "Date/Time" Title option and the running time and date appear on the video. BUT- there is a problem. The time is wrong.
    When I import a video clip (from my Panasonic HDC-TM80) into iMovie, I can see the "time and date created" as well as the "length" of the video clip. The time and date created shows the time and date of when the clip ENDS. When I overlay the "Date/Time" Title, it starts the time (at the beginning of the clip) from the created time (which is actually the end).
    Example:
    Clip Created (end of clip): 3/23/11 10:30:00am
    Length of clip: 12 min. 35 sec.
    The actual Date/Time Title should show 10:17:25am at the beginning and runs through 10:30:00am (the end).
    But instead it shows 10:30:00am at the beginning and runs through 10:42:35am. This obviously results in a 12 min. 35 sec. inaccuracy.
    Is this a problem with the software? Is there a way to contact someone to alert them of this problem? Or am I missing something simple?
    Thanks in advance for anyone's help.
    -as a quick fix, I adjusted the time and date on the video clips so that it would show the correct info, but I'm usually working with several clips at a time and it is laborious to change each one.

    I don't have an answer but was wondering how you like the TM80? Except for the date/time issue, is it compatible with iMovie'11?
    Thanks!

  • I have got problem with "Date & Time"

    I have bought a new Macbook Air 13"
    I have chosen "set date & time auto..."
    However, it shows in up right corner wrong date. Also all mail, reminders and etc work with wrong date.
    Please, tell me what to do with this problem.
    Sincerelly,
    Mark

    Incorrect date or time displayed in various applications

  • Problem with date + time

    Hi,
    I have a long time problem.
    I want to insert to my table the result of JXDatepicker + JSpinner (time HH:ss).
    It is work until I am calulate todays link in millisecound.
    please run my exampele to see my problem and I'll be happy if u can help me (cell 0,0).
    if you click in every date exept todays link, u get good result format (yyyy-MM-dd HH:ss:00)
    import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Date;import javax.swing.JButton;import javax.swing.JFormattedTextField;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.table.DefaultTableModel;import org.jdesktop.swingx.JXTable;public class MyTable extends JFrame implements ActionListener {     private JXTable table;     private QM6JXDatePicker date;     private QM6JSpinner spinner;     private JFormattedTextField TxtfPriority;     public MyTable() {          String[] columnNames = { "Date", "String", "Integer" };          Object[][] data = { { new Date(), "AAA", 11 }, { new Date(), "B", 22 },                    { new Date(), "CCCCCC", 3 }, { new Date(), "D", 4 } };          DefaultTableModel model = new DefaultTableModel(data, columnNames);          table = new JXTable(model);          table.setPreferredScrollableViewportSize(table.getPreferredSize());          JScrollPane scrollPane = new JScrollPane(table);          getContentPane().add(scrollPane);          JButton button = new JButton("Update");          button.addActionListener(this);          getContentPane().add(button, BorderLayout.SOUTH);          getContentPane().add(getPanel(), BorderLayout.NORTH);     }     public JPanel getPanel() {          JPanel panel = new JPanel();          date = new QM6JXDatePicker();          spinner = new QM6JSpinner();          panel.add(date);          panel.add(spinner);          return panel;     }     public void actionPerformed(ActionEvent arg0) {          java.sql.Timestamp newDate = new java.sql.Timestamp(date.getDate()                    .getTime());          long miliSecDate = newDate.getTime();          String s = spinner.getTime();          String[] timeStr = s.split(":");          long miliSecTimeH = Long.parseLong(timeStr[0].trim());          long miliSecTimeS = Long.parseLong(timeStr[1].trim());          long miliSecTime = ((miliSecTimeH * 60 * 60) + (miliSecTimeS * 60)) * 1000;          newDate.setTime(miliSecTime + miliSecDate);          table.setValueAt(newDate, 0, 0);     }     public static void main(String[] args) {          MyTable frame = new MyTable();          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);          frame.pack();          frame.setVisible(true);     }}
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import javax.swing.JPanel;
    import org.jdesktop.swingx.JXDatePicker;
    import org.jdesktop.swingx.JXHyperlink;
    import org.jdesktop.swingx.calendar.JXMonthView;
    public class QM6JXDatePicker extends JXDatePicker {
         private String[] dateStr = null;
         private DateFormat df;
         private SimpleDateFormat df2;
         private JPanel newLinkPanel;
         private JXMonthView calend;
         public QM6JXDatePicker() {
              df = DateFormat.getDateInstance(DateFormat.LONG);
              df2 = new SimpleDateFormat("dd/MM/yyyy");
              dateStr = new String[] { "dd/MM/yyyy" };
              getJXMonthView();
              LinkPanel();
              setFormats(dateStr);
              setMonthView(calend);
              setLinkPanel(newLinkPanel);
         private void LinkPanel() {
              newLinkPanel = new JPanel(new BorderLayout());
              JXHyperlink todayLink = new JXHyperlink();
              todayLink.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        getEditor().setText(df2.format((new Date())));
                        setDate(new Date());
                        getMonthView().getParent().setVisible(false);
              todayLink.setText("Today: " + df.format(new Date()));
              newLinkPanel.add(todayLink, BorderLayout.CENTER);
         private void getJXMonthView() {
              calend = new JXMonthView();
              calend.setTraversable(true);
              calend.setDayForeground(7, Color.RED);
              calend.setDaysOfTheWeekForeground(Color.BLUE);
              calend.setSelectedBackground(Color.YELLOW);
              calend.setFirstDayOfWeek(Calendar.SUNDAY);
         public JXMonthView getCalend() {
              return calend;
         public void setCalend(JXMonthView calend) {
              this.calend = calend;
    import java.util.Calendar;
    import java.util.Date;
    import javax.swing.JSpinner;
    import javax.swing.SpinnerDateModel;
    public class QM6JSpinner extends JSpinner{
         private JSpinner.DateEditor dateEditor;
         public QM6JSpinner() {
              setModel(new SpinnerDateModel(new Date(),
                        null, null, Calendar.MINUTE));
              dateEditor = new DateEditor(this, "HH:mm");
              setEditor(dateEditor);
         public String getTime() {
              return dateEditor.getTextField().getText();
    }Tanks alot!
    Yael

    The main class here...
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Date;
    import javax.swing.JButton;
    import javax.swing.JFormattedTextField;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.table.DefaultTableModel;
    import org.jdesktop.swingx.JXTable;
    public class MyTable extends JFrame implements ActionListener {
         private JXTable table;
         private QM6JXDatePicker date;
         private QM6JSpinner spinner;
         private JFormattedTextField TxtfPriority;
         public MyTable() {
              String[] columnNames = { "Date", "String", "Integer" };
              Object[][] data = { { new Date(), "AAA", 11 }, { new Date(), "B", 22 },
                        { new Date(), "CCCCCC", 3 }, { new Date(), "D", 4 } };
              DefaultTableModel model = new DefaultTableModel(data, columnNames);
              table = new JXTable(model);
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JScrollPane scrollPane = new JScrollPane(table);
              getContentPane().add(scrollPane);
              JButton button = new JButton("Update");
              button.addActionListener(this);
              getContentPane().add(button, BorderLayout.SOUTH);
              getContentPane().add(getPanel(), BorderLayout.NORTH);
         public JPanel getPanel() {
              JPanel panel = new JPanel();
              date = new QM6JXDatePicker();
              spinner = new QM6JSpinner();
              panel.add(date);
              panel.add(spinner);
              return panel;
         public void actionPerformed(ActionEvent arg0) {
              java.sql.Timestamp newDate = new java.sql.Timestamp(date.getDate()
                        .getTime());
              long miliSecDate = newDate.getTime();
              String s = spinner.getTime();
              String[] timeStr = s.split(":");
              long miliSecTimeH = Long.parseLong(timeStr[0].trim());
              long miliSecTimeS = Long.parseLong(timeStr[1].trim());
              long miliSecTime = ((miliSecTimeH * 60 * 60) + (miliSecTimeS * 60)) * 1000;
              newDate.setTime(miliSecTime + miliSecDate);
              table.setValueAt(newDate, 0, 0);
         public static void main(String[] args) {
              MyTable frame = new MyTable();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);
    }

  • Problem with date Time Format

    Hi All,
    I want to transform the input date format to ''YYYY-MM-DD-hh.mm.ss'.I am using the below format in format-datetime function in BPEL:
    '[Y0001]-[M01]-[D01]-[h01].[m01].[s01]'
    It is giving correct time and format between 1 and 12 o clock timings in hours('HH' place).But when we give more than 13 it is not giving proper timinngs though it is giving proper format.It is not following 24 hrs format
    Ex : When I give input value '2012-04-05T00:30:00’ and it is transforming '2012-04-05-12.30.00’ (I want it in the same time means '2012-04-05-00.30.00’
    Ex 2: When I give input value '2012-04-05T15:30:00’ and it is transforming '2012-04-05-03.30.00’(I want it in the same time means '2012-04-05-15.30.00’
    Why it is coming like that?Is there any mistake in the specified format('[Y0001]-[M01]-[D01]-[h01].[m01].[s01]')?

    Hi,
    Put H01 and not h01.
    Arik

  • For custom tables should we use UTC for date/time fields

    A general question.
    Can anyone confirm that SAP does seem to be moving towards storing date/time in UTC format?
    We're building custom tables and we're making it a standard to store date/time fields in UTC format.
    Regards,
    Lavaughn

    Hello Lavaughn,
    I can not speak for SAP, but from my personal experience TimeStamps are the state of the art to store time date info in db tables. Even with date/Time fields a conversion to the local timezone is necessary. Of course you can reuse your db definition on dynpros. But since UI and business logic will be divided anyway this is also not really a valid point.
    Best Regards
    Klaus

  • Adobe LiveCycle Date/Time Field Scripting Question

    I have a date/time field in Livecycle which the end user chooses a random date from.  I need to populate a date 180 days from this date for an eligible to date/time field.  I have tried various javascript and formcalc options with no success.

    Try this site here for a reference: http://eslifeline.wordpress.com/2008/09/26/date-manipulation/
    The following was the use case. A form has 2 TextFields Start_Date and End_date
    User enters a certain date in the Start_Date text field for example 09/24/08 (MM/DD/YY)
    The End_Date should add 90 days to the Start_date and populate the End_Date
    The following script would do that
    var current = Date2Num(Start_Date.rawValue, “MM/DD/YY”)
    var future = current+90
    var newDate = Num2Date(future,”MM/DD/YY”)
    form1.#subform[0].End_Date.rawValue = newDate 
    Validating End Date is later than Start Date
    var diff = Date2Num(EndingDate.rawValue, “YYYY-MM-DD”) – Date2Num(StartingDate.rawValue, “YYYY-MM-DD”)
    if (diff > 0) then
    xfa.host.messageBox(“The End date is later than start date”)
    else
    xfa.host.messageBox(“PLEASE CHECK….The End date is before the start date”)
    endif

  • Date time field problem

    Hello there
    This maybe a simple problem but on the Date time field object i have input a display pattern and put the error message in. When I preview the PDF and populate the object with random text the pop up box will display my error message.
    What it does not do is clear the text I have input so the date can be re-entered correctly, which is what I was expecting. Therefore the user can continue on without addressing the date correctly.
    Can anyone advise what I should do to get this to work?
    Thanks
    Darren

    Hi
    The first time I thinkanyone has answered their own post. So for the benefit of anyone else I added the folowing script to the exit event
    of the date field object
    if (page.subform.dateobject.rawValue == page.subform.dateobject.formattedValue) {
    xfa.host.resetData("xfa.form.Formtitle.Page.subform.datefieldobject")
    Not sure why it works but just played around with it.

  • How can I set a date range for a Date/Time Field in LiveCycle ES2?

    I need to set a specific date range for a form set up in LiveCycle ES2. Cannot see where i allows me to do that without a code entered.

    Hi,
    You can't set a start and end date for the date/time field, the best you can do is validate the range after the user has selected it.
    An alternate is to make your own date / time field, like this sample http://adobelivecycledesignercookbookbybr001.blogspot.com.au/2013/05/an-alternative-date-p icker-for.html
    Regards
    Bruce

  • Issue: format / "language" of current Date (in date/time field), javascript only

    Hi,
    I have 2 date fields in my form, which should display the date in differnt format. (yyyy.mm.dd /  dd-mm-yyyy)
    To get the current date I use java script only
    Formular1.p1.date_YYYYmmDD::initialize - (JavaScript, client)
         var date = new Date();
        this.rawValue  =  date.toLocaleDateString();
    My first problem is (red): I get date in English, but I want it in a different language. As it was set in form settings
    My second issue is: how can I format a date/time-filed (not a text field) in javascript with a specific pattern on init-event?
    It seems my code in init-event overrides the pattern configuration of the date/time-field
    Here is my form, if anyone want to check it:
    https://acrobat.com/#d=zeOMyj9MhBdYbVWk8S1pHw

    Hi,
    I think both problems are the same, when setting a date/time field using the rawValue the format always has to be yyyy-mm-dd, if you use any other format the value is just treated as text and displayed without formatting.  
    var date = new Date();
    this.rawValue = util.printd("yyyy-mm-dd", date);
    You can also set the formattedValue if you have a date in the correct format. 
    var date = new Date();
    var currentLocale = xfa.resolveNode("#localeSet.#locale").name;
    var dateFormat = "date("+currentLocale+"){DD MMM, YYYY}"
    this.formattedValue = util.printd(dateFormat, date, true) 
    This code assumes the display pattern is date{DD MMM, YYYY}
    The date format specification is in the XFA Spec http://partners.adobe.com/public/developer/xml/index_arch.html
    Regards
    Bruce

  • Adding Date/Time Field + X Number of Days - Basic Calculation Question

    I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
    I have a simple form containing a table. The table appears as such:
    Text
    Formatted as Date/Time Fields
    Header 3
    Monday
    user wil choose the beginning date (Date/Time) this is DateTimeField1
    Tuesday
    this should calculate DateTimeField1 + 1
    Wednesday
    this should calculate DateTimeField1 + 2
    Thursday
    this should calculate DateTimeField1 + 3
    Friday
    this should calculate DateTimeField1 + 4
    Saturday
    this should calculate DateTimeField1 + 5
    Sunday
    this should calculate DateTimeField1 + 6
    Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
    Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
    Thought this was going to get me close. No cigars though!
    Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
    Thanks

    Here an addition for you date field.
    This FormCalc script in the exit:Event will check it the selected date is on a monday.
    If not it will go the days back until the last monday.
    var Selection = Date2Num($.formattedValue, DateFmt(2))
    var WeekDay = Num2Date(Selection, "E")
    var NewDate
    if (WeekDay eq 1) then
              NewDate = Selection - 6
    elseif (WeekDay eq 3) then
              NewDate = Selection - 1
    elseif (WeekDay eq 4) then
              NewDate = Selection - 2
    elseif (WeekDay eq 5) then
              NewDate = Selection - 3
    elseif (WeekDay eq 6) then
              NewDate = Selection - 4
    elseif (WeekDay eq 7) then
              NewDate = Selection - 5
    else
              NewDate = Selection
    endif
    $ = Num2Date(NewDate, "EEE DD.MM.YYYY")
    Hope this helps, too.

Maybe you are looking for

  • I want to work with you,,,,

    We all know that . Microsoft is the second largest company in the world , but our Windows Phone ( Microsoft mobile device) smartphone is  5th, position in the world. This is not good about for windows phone. let start discuss about windows phone. how

  • Static NAT for FTP access

    NAT overload has been done successfully as follows: 1. ip nat inside and ip nat outside configured on the appropriate interfaces i.e.fa0/0 and fa0/1 2. default route added on the router. 3.additional configuration is added: ip nat inside source list

  • HT4847 I bought 15g of cloud space and when I changed my password it went down to 5g and says I need to purchase more how can I recover my lost backups I stll have more gigs on my old password

    I bought 15g of cloud space and when I changed my password it went down to 5 g and I lost my backup how can I restore my old backup without buying more space because I had enough space with my old password

  • Reorganize BIA landscape ? Srange problem

    HI Team, I am getting this "Reorganize BIA landscape" message in BIA check result in RSDDBIAMON2. But when I execute the Reorganize BIA landscape action ...  system pop up information box saying " Reorganization of BI accelerator landscape not necess

  • Photoshop 'Live'

    This may be more of a suggestion than a question. I am thinking about setting up a website, mobile and iPad app that will allow users to add and remove elements, layers, and so on to a background layer. Do any of the Adobe applications have this feat