Filling DateField and TimeField, according to a format, with incoming data - forms

I have a datefield and a timefield in my ExtJS form and I have to fill them with data sent from the server. The server sends data in the following format (via Ajax):
date=2013-05-10T00:00:00.000+04:00,time=1970-01-01T00:30:00.000+03:00
How do I get that displayed in the form fields formatted as Y/m/d and H:i respectively? I have tried various combinations but they do not work. The fields remain either blank or filled with the entire data value sent from the server.
UPDATE:
If it would make things easier, I can make the server send the values in a different format, say milliseconds...

The data which u send from backend is in "ISO 8601 date" format this has been supported by extjs. This needs to be resolve with help of Ext.Date.format class. Refer below link for your reference.
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.Date
You need to add 'format' config to datafield and timefield and pass your format as string.
Thanks

Related

Returned query values are different type in FastReport 4

I am trying to get a numeric value of my firebird sql query.
In IBExpert the data types are correct "Numeric(18,2)" but when it comes to FastReport it displays me not the Numeric18,2 datatype. It cuts the ,00 off.
Anybody who can help me?
Your data is retrieved properly, you need just to display it well formatted.
Set the display format of the text box as described in documentation.
If the text box contains different formats for multiple values you need to use inline formatting for each value.

Word Fillable Form with Time Field

Trying to make a fillable form
That has a time input
that is in a format like i.e 11:00 AM
and that's the only way you can put the time in
You can do that with a simple formfield (Developer|Controls|Legacy Tools>Text Form Field), then accessing its properties and setting the Type to 'Date' and the Date Format to 'h:mm am/pm'.
Do note that formfields only work with the 'Filling in forms' editing restrictions applied; they should also not be used in a document containing content controls, as the two weren't designed to work together and trying to use them that way can cause problems.

Invalid Date error when entering record on Sharepoint list Datasheet view

I have a list on Sharepoint 2013. I've often use the Edit this list link to make bulk changes to the list in datasheet view with no problem. Last week I had a bunch of new records I needed to add so decided bulk copy and paste from Excel would be best. However, I get the error "Invalid date/time value. A date/time field contains invalid data. Please check the value and try again." The field is Date/Time with Date only display. The format I copied in was mm/dd/yyyy, which is how it's displayed (I realize there's a difference between formatting and display). In the past I've used this format to update dates with no problem. I've tried manually changing the date to other formats like yyyy/mm/dd (or with dashes -), and using the date picker and nothing works. I can add a new item using the form and no problem with the date. It's only happening in datasheet view.
I have 70+ records to add and would rather not have to open a new form for each one (I'm only adding info to 7 of the fields, and I first only pasted a couple records to make sure there were no issues). Are there any recent known issues about date fields in datasheet view? It's a pretty straightforward thing, no calculations are being used, I'm not trying to connect to another service, or use outlying dates (dates are all 2017) so I'm perplexed why this is an issue now and not before. Any thoughts on this would be appreciated.
Found the issue. I had another date field I was not using in that view that for some reason the default value had been set to Calculated field with a value of 1/1/1111. No idea how that got there but I removed that and set the default value to None and now the problem is gone. I found it by creating a new view with every date field in the list and systematically copying a date into each field (in bulk edit) and trying to save after each one until it saved. Then I checked the settings for the field that I was able to save with.

Reading Date from Database in the incorrect Format

I have a date fields in a SQL database which are stored in date and datetime2 format.
When executing the Read method on the SmartObject linked to this table, it tries to force the date into an American Format (MDY), and either display this date if it is valid, or fails to show anything (i.e. if the day is above 12)
However, when executing the List method, the data seems to display correctly, as it does when using the SmartObjectTester to execute the Read method on the object.
Is there a way to prevent this from happening, and to have the Date field be read in DMY format, and thus display correctly?
You can change the Data Type of the Field and in the Style Builder Change the "Date and Time" setting to use the format you need. Its always best to use User Settings. Style Builder for Date
This problem came from having the configuration of the Web.config set up to use a different culture to the one which the server K2 was installed on is using.
To solve this, ensure they are the same, and the Server should be able to read from the DB correctly, and thus display on the SmartForms without switching the dates around.
The relevant line to change in the Web.Config is
<add key="SmartObject.ExecutionCulture" value="en-US" />

Get minutes from a time field in a CakePHP form?

I'm using CakePHP to build a mixed martial arts (MMA) website. I have a form to add matches, and one of the fields is for rounds length, which is in minutes, and which I'm storing in my database as a TIME value.
In my form, I only want the minutes portion of the value editable. I've tried creating a field with the name Match.rounds_length and setting the type to number, but can't get it to populate with the minutes value.
Here's what I have currently:
$this->Form->input('Match.rounds_length' => array('type' => 'time'));
I did find this page in the CakePHP online documentation: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions. But I can't seem to get it to work in my setup.
Could someone familiar with CakePHP tell me how to create just an open text field that the user can specify the number of minutes a round should last that would then be saved as a time value in my database, and populated properly in my edit form?
I tried the following. And it worked.
echo date('i', strtotime('00:05:00'));
date() format specifiers list will help you to achieve the same as you mentioned in your question.
Kindly ask if it not worked for you.