Input Date as MM/yyyy format in ASP.NET - asp.net

I need to put start date and end date on my page.
It will be only month and year date, with day set to 01 in the start date and to last day of month in the end date.
How can I achieve this feature?
I have tried the Ajax MaskedEditExtender, but when I put 99/9999 in the mask, with the maskType="Date", it give me a javascript error, because the day is missing.

I take it you are trying to validate the entry. I suggest you use a CustomValidator - you'll need to write your own JavaScript for the client-side validation and another validation method for the server-side validation. All you need to do is split the string on / and check the first part is in the range 1..12 and the second part is a valid year.

Related

Issue with date checking

In Apex app I've a region called Person on a page. Inside a region there is a masked date picker. I have a task to validate the date of birth. So, the date of birth could not be less 1900 year. In "Conditions" section i'd been trying to write an pl/sql expression:
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM-DD-YYYY')
but it doesn't work. What am I doing wrong?
You put it to wrong place - "Condition" is used to decide whether an item will (or will not) be rendered on the screen.
Validation should be put into ... well, validation (obviously).
right-click the P1002_CONTR_BIRTH_DATE date picker item
choose "Create Validation"
set its type to "PL/SQL function (returning error text)
use such a code (presuming that you set the date picker format mask to MM-DD-YYYY):
if to_date(:P1002_CONTR_BIRTH_DATE, 'mm-dd-yyyy') < date '1900-01-01' then
return ('Error - can not set it to before 01-01-1900');
end if;
set it to fire when SUBMIT button is pressed
Alternatively (and way simpler) would be to open date picker item's property palette, navigate to its "Minimum date" property and put (for example) -120y in there which will allow dates that are higher than sysdate - 120 years (today, Apex would raise the
Birth date is less than specified minimum date 04-15-1898'
which isn't exactly "1900", but - you can easily calculate it, right? Also, -120y is somewhat more flexible than fixed year 1900.
Now you have two options, pick the one that suits you best.
TO_DATE() method is to convert a string to date, the string format should be the same as format_mask.
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01-01-1900', 'MM-DD-YYYY')
or
TRUNC(TO_DATE(:P1002_CONTR_BIRTH_DATE, 'MM-DD-YYYY')) > TO_DATE('01.01.1900', 'MM.DD.YYYY')
and also make sure :P1002_CONTR_BIRTH_DATE is also the same as format.
For detail

Google Docs Forms - need Pre-fill Date & Time Entry with current date and current time

Google Forms I need Pre-filled current Date & current Time Entry in date and time fields of my google form. How to do it
My solution is to make the Date field optional. The default is to assume the todays date which is what you get from the timestamp field. In case it needs to be anything else you can enter it manually.
A simple code-free solution is to make separate sections in your form and use the feature that routes users to different sections based on responses. The first section asks whether the form is for the current date/time. If yes, you use the timestamp as the date and time and route the user to the main section with your questions. If not, route them to a section to set the date and time, and then after that route them to the main section.
2023 Solution
-Google Forms has updated how dates are passed through URL parameters.
Instead of passing each component of a date as a separate param, you now pass them using the same syntax as all other fields using the YYYY-MM-DD format for your date value.
Here is an example URL:
`https://docs.google.com/forms/d/e/${formId}/viewform?usp=pp_url&entry.${dateEntryFieldID}=${YEAR}-${MONTH}-${DAY}`

Telerik RadDatePicker not picking up dates post year 2030

I am using RadDatePicker control for start and end date input controls on my form.
I am taking "01/01/1980" as min date and "12/31/2049" as max date. I am facing a problem when I enter the date manually in Date text box.
Scenario 1: I enter date as 123129. RadPicker correctly picks it up as 12/31/2029 and displays the formatted date value.
Scenario 2: I enter date as 123130. I get a client side validation warning. No matter what day and month I enter, it freezes every time on year greater than XX/XX/29 (2029).
Scenario 3: I enter date as 12312030 - complete year instead of just last 2 digits. RadPicker correctly picks it up as 12/31/2030 and displays the formatted date value.
I tested all 3 scenarios on ASP.NET Calendar Demo - DatePicker - First Look as well.
I am not sure why the validation kicks in even when the max date is set as 12/31/2049. Please assist me in resolving this issue.
Thanks,
Vaibhav
"The years starting from 30 and greater are parsed as 19.. like if u say 30th(year) it would get it like 1930, 123130 will be parsed as 12/31/1930. this is invalid because the default value of the MinDate i.e. 1/1/1980.
In Order to solve this set the ShortYearCenturyEnd property of the DateInput to 2099.
Hope i answered the question.

Symfony 2 - Generate calendar month table with links to events in it

I have an Entity called Event, with fields startDate, startTime, endDate and endTime. startDate and endDate are dates of which endDate can be NULL if it is the same of startTime (I can change this behaviour if it makes things easier as I have no events yet). startTime and endTime can not be NULL. It also has an isOnDate(\DateTime $date) method, which returns true if the event will run on the given date.
It was like pain, but I finally generated an HTML table of any given calendar month, passing the day of week of the month's first day (firstDow) and the number of days in that month (numDays) as template variables.
The next step would be to make some table cells links to event or event listing pages if the given days has one or more events. Now I'm a bit stuck, as I don't know how to get the DateTime() object of each cell in a template.
Can someone give me a hint on this? Or am I making it totally wrong?
You can display DateTime Objects as Text Dates using Twig Filter date:
{{ event.startDate|date("m/d/Y") }}
You could use Ajax and jQuery to link dynamically your page with your database. You could start from this calendar code for Symfony2: http://www.symfocal.com

Setting report to current date

I have a report where it shows meetings and their requirements. However i just want the report to show ONLY today's stuff--not the entire week's worth.
I tried setting my group header (i'm grouping by day) to currentdate but yet it still shows me the entire week. I then have to go to the grouping tree and select today's date. Is there any way to run my report and have it ONLY show today's stuff and nothing else???
Any ideas?
Use the select expert to limit the results to today's date. printdate is a special Crystal Formula keyword.
{table.date_field} = printdate
Or, if you're working with a datetime db field you can strip the time with CDate
CDate({table.date_field}) = printdate
One way would be to change your query so that it's only getting one day's worth of data; that is, assuming your data contains a date field. To take it a step further, you could add date parameters to the query itself and leave the group headers as is. That way, you can have one day of data, or data from a specific date range.
If you have no influence (or desire) to change the way data comes into Crystal Reports, you could also add a formula via the Section Expert to suppress the group or detail section unless the date is the current date.

Resources