jQuery Input Masks for datetime input using sql timestamp yyyy/mm/dd hh:mm:ss - sql

I'm using Robin Herbot's jQuery Input Masks plugin on my project.
It's very good but I need sql timestamp mask: yyyy/mm/dd hh:mm:ss I don't konw if i'm doing something wrong but it seems datetime alias shows only hours and minutes.
I've tried some changes on mask but not successful.
Thanks.

I see the question is from long ago, I also came here while trying to learn jquery.inputmask.
Remember to always include what you have done (code sample) when asking a question. Even if it is wrong/not working, it will help the one providing an answer, and others looking for answers.
In general terms, I found it somewhat helpful to read through the jquery.inputmask.xxx.extensions.js files, where xxx = date in this instance. In there you can see how more complex aliases are constructed from more basic ones (by overriding the basic ones), and you can apply the same ideas in constructing a new alias if you don't find a useful one.
Code that should work for your case:
$("#tsfield").inputmask("timestamp", {
mask: "y/1/2 h:s:s",
placeholder: "yyyy/mm/dd hh:mm:ss",
separator: "/",
alias: "datetime",
hourFormat: "24"
});
... which creates a new alias named timestamp, overriding datetime, and applies it to the input with id="tsfield".
If you have more than one input field with the same input mask on your page, I find it is better to create the new alias just once in your $(document).ready(), and then apply it by name to each field (refer to jquery.inputmask.date.extensions.js and documentation for instructions).

Related

How to use EXDATE in Full Calendar via object option

Looking at this answer, it is shown how to include EXDATE in the string format option in FullCalendar.
But FullCalendar provides a convenient alternative to the long string. They allow you to use an object instead. Unfortunately their documentation doesn't really cover anything beyond that:
The rrule property accepts whatever the rrule lib accepts for a new
RRule. See the docs. You can specify a string or an object.
The events we use are pretty heavy already and I would love to avoid adding additional complexity that would involve me writing some kind of mapper to generate this string.
I would like to know how to be able to exclude a list a of dates from a recurrence rule using the object format.
I've tried providing a date object of the specific date. I've tried providing an ISO string. I've tried including them in an array.
Update
This is the latest iteration that I'm trying:
...
const rruleSet = new RRuleSet();
rruleSet.rrule(new RRule(options));
// Repeat every day except on Nov 22, 2019
rruleSet.exdate(new Date(Date.UTC(2019, 10, 22)));
event.duration = {
seconds: event.event_length,
};
event.rrule = rruleSet.toString();
...
This renders the recurring dates (time is a little off) but the date that I'm trying to exclude still renders.
In order for your exclusion rule to match the generated event, you must include the specific time as well. I expect this is because if you had events repeating multiple times in the day it wouldn't know which one you were trying to exclude.
(If your events were "all-day" style events, without a specific start time, then setting just the date in exdate would be ok.)
Therefore, changing
rruleSet.exdate(new Date(Date.UTC(2019, 10, 22)));
to
rruleSet.exdate(new Date(Date.UTC(2019, 10, 22, 10, 30)));
will solve your problem
Demo: https://codepen.io/ADyson82/pen/jOORaOZ

dojo/mvc/at doesn't return dijit/form/DateTextBox in format of constraints datePattern

This seem's to be a question often asked, but there doesn't seem to be an easy answer or an answer at all, so I risk a duplicate here, and ask again - I feel like having a puzzle with 4 pieces and don't manage to put them together:
I'm using a dojo date picker like this
<input data-dojo-type="dijit/form/DateTextBox"
data-dojo-props="constraints: { datePattern: 'yyyy-MM-dd'},
value: at(model, 'myDate')" />
The date picker displays the date in UI like I want, but the value that's assigned in model.myDate keeps being in ISO format - I'd need that to be in yyyy-MM-dd, too.
I know that I can use dojo.date.locale.format to post-process the value, but that would be after it is saved in model.myDate. I'd like to return the value in the correct format right away. Return value null if there's no input, return value undefined if there's no valid value, and return value in format yyyy-MM-dd when the given date is valid.
Maybe I can integrate that call to dojo.date.locale.format somehow? Something like .transform(..) or whatever is possible in dojo!?
I also read about overwriting the serialize method, but I don't see how and where to do that in here.
Any ideas or hint in the right direction? Many thanks in advance.
Hi just wondering if something like at(model, prop).transform(converterObj) helps: http://dojotoolkit.org/reference-guide/1.10/dojox/mvc/at.html#data-converter

date object prefixing with # vb.net

I am writing sample code for Date conversion using VB.net.
Problem i am facing that it is prefixing and suffixing with hash(#) symbol.
ex : #2010-12-12#.
How to remove # symbol so that i can only date.
Given your comment, it sounds like this is actually probably just an issue of displaying a DateTime in the debugger. It showing you the DateTime literal form that you could use in VB. This is a bit like C# developers who are concerned about their strings having double backslashes in, when actually that's just the debugger showing escaping.
The DateTime itself doesn't really contain the hashes, and none of the normal format strings will produce hashes either. If you want to see it without the hashes, add a watch for
arrTxLifeReq(0).TransExeDate.ToString()
Does the code which is part of your real program have any problems? If so, please post details of those problems rather than just what the debugger is showing.
Just replace # with ''
for example
string dt = "#2010-12-12#";
dt = dt.Replace ("#","");

Format date like M/D/Y

I got a date of the type SYDATUM and wondering how to format it in a format like m/d/y.
I've found some snippets on the web, but they were not really helpful.
-thanks yor your help.
You should be more specific - what exactly do you want to do with the date (use type D internally, it's shorter and does the same thing).
Do you want to WRITE it to a list screen? Use the formatting options described in the documentation and online help:
WRITE l_my_date MM/DD/YYYY.
Do you want to convert it to a text variable? Very similar:
WRITE l_my_date TO l_my_text MM/DD/YYYY.
To set the date format in a SAPscript form, see the SET DATE MASK command.
To print the formatted date in a SmartForm, use the WRITE command and a temporary variable (yes, ugly, I know...)
Most controls (ALV Grid for example) should take care of the format automatically.
However - be careful when hard-coding the format into your application. Usually you don't have to do this because the system automatically uses the format specified in the user master data. This ensures that every user will see the date formatted according to their locale settings.
Normally it's better to export the date into the plant level country specific date format:
if w_country is initial.
select single LAND1
from T001W
into w_country
where WERKS eq w_the_plant.
endif.
SET COUNTRY w_country.
write w_the_date to w_export.
for example 03/04/2002 could be different date in different country.
You can try the keyword TRANSLATE. Alternatively suggest you could have a look at this link

VisualBasic Month function inconsistency

I'm working in a web application using VB.NET. There is also VisualBasic code mixed in it, in particular the Date variable and the Month function of VB.
The problem is this part:
Month("10/01/2008")
On the servers, I get 10 (October) as the month (which is supposed to be correct). On my machine, I get 1 (January) (which is supposed to be wrong).
Two of my colleagues (on their own machines) get different answers, one got 1, the other got 10.
The question is, why is this so?
On my end, I can solve the problem by using .NET's DateTime's Parse (or ParseExact) function to force everything to be "dd/MM/yyyy" format. This works. I'm just wondering why there's an inconsistency.
Extra info: I know the parameter for Month function is supposed to be a Date variable. The code used a string as parameter, and Option Strict was off, and the developers mainly let VB do its own conversion thing. (Legacy code maintenance has a lot of inertia...)
If it helps, the version of Microsoft.VisualBasic.dll on the servers is 7.10.6310.4 (under the Framework folder v1.1.4322). The version on mine (and my 2 colleagues') machine is 7.10.6001.4.
Edit: Regional settings for all machines already set to dd/MM/yyyy format (short date format).
This normally has to do with the regional settings, and more specifically the date/time formats. If you set these formats so that they are all the same on the machines you're testing on, the results should be consistent.
Your idea of using ParseExact is definitely the better solution to go with, IMHO.
This is because the runtime has to convert your given value "10/01/2008" which is indeed a string implicitly to the DateTime datatype.
When converting strings to dates and the other way round, the string format depends on the locale settings of windows.
See this link on msdn.
In this article a way to specify a date literal which is independent of your locale settings:
Just enclose the date with the sign # and specify it in the form mm/dd/yyyy:
So the code
Month(#10/01/2008#)
should give you the answer 10 on any machine.
Ther a two more worarounds given in that msdn article:
1. Use the Format Function with predifned Date/Time Format
To convert a Date literal to the
format of your locale, or to a custom
format, supply the literal to the
Format Function, specifying either
Predefined Date/Time Formats (Format
Function) or User-Defined Date/Time
Formats (Format Function). The
following example demonstrates this.
MsgBox("The formatted date is " &
Format(#5/31/1993#, "dddd, d MMM
yyyy"))
2. Use the DateTime-Class Constructor to construt the right DateTime value
Alternatively, you can use one of the
overloaded constructors of the
DateTime structure to assemble a date
and time value. The following example
creates a value to represent May 31,
1993 at 12:14 in the afternoon.
Dim dateInMay As New
System.DateTime(1993, 5, 31, 12, 14,
0)