jqwidgets-datetimeinput date format d MMMM yyyy not displayed correctly - jqwidget

I am using jqwidgets-datetimeinput to display and input formatted date. It is working fine for most of the use cases but for the format d MMMM yyyy it is not behaving correctly.
it is showing as 6/11/2020 June 2020 instead of 11 June 2020

Interesting. I think you just found one of the many bugs/"features" that plague jqWidgets.
Upon further investigation, this seems to happen when d is the end of the format string, or is followed by a space character. To get around this, you can use a non-breaking space:
'd\u00a0MMMM yyyy'
If you're on Windows, you can also do Alt+0160 to type it out, but this may be unwise, as the two characters look identical.

Related

How to stop pandas converting some dates automatically when reading a csv

I have a csv, and one column is date, format dd/mm/yyyy.
I read it using z=pd.read_csv('property_scrape.csv')
My raw data is:
After I read it in, some of the values are kept in the format I downloaded (dd/mm/yyyy), while somewhere in the middle, the dates are converted to yyyy-mm-dd:
27 01/10/2019
28 01/10/2019
29 01/10/2019
...
21092 2020-08-22
21093 2020-08-22
21094 2020-08-22
Name: Date, Length: 21122, dtype: object
Does anyone know why this happens?
Also, is there a way to ensure that this date column is always read the correct/constant way?
The problem is Pandas samples the first row and thinks it is MM/DD/YYYY instead of DD/MM -- there isn't a real way to know this. Then later when it finds 22, which not a valid MM it defaults to object/string.
You can add flag infer_datetime_format=False and it should read as strings then you can parse it -- you can pass a lambda to read_csv as well, not sure if an easier way to just pass a format string -- see article article dsexchange 34357

Format a Date Time to the Full date/time pattern (short time) in Orchard

Within Orchard CMS (version 1.6) I have a Query that displays a DateTime property called StartDate. When setting it up I chose the "Full date/time pattern (short time)" as the Date format, and then I was rewriting the output as follows:
<My html text here> {Text}
This would render as "My html text here Saturday, April 13, 2013 2:30 PM".
I realized that for users on a different time zone, the date/time was being converted automatically and instead of displaying 2:30 PM (server is at PST), it was displaying 5:30 PM (user was at EST).
Following Bertrand Le Roy's solution here, it worked out nice with one minor issue.
Now my code is this:
<My html text here> {Content.Fields.MyContentType.MyDateTimeField.DateTime.Local}
And here is the result: "My html text here 4/13/2013 2:30:00 PM".
The formatting is not the one I would rather use.
Does anyone know how can I format this to the Full date/time pattern (short time)?
Thank you in advance.
{Content.Fields.MyContentType.MyDateTimeField.DateTime.Local.Format:dddd, MMMM d, yyyy h:mm tt} should do the trick.

NSDateFormatter string with subseconds and timezone

I have banged my head against this for too long now!
I have a string: 2012-09-27T18:00:00.000-04:00
I have a format: [dateFormatter setDateFormat:#"yyyy-MM-dd'T'HH:mm:ss'Z'"];
I get a null result converting the string.
Can someone help with the correct date format?
According to the documentation for NSDateFormatter:
The format string uses the format patterns from the Unicode Technical Standard #35. The version of the standard varies with release of the operating system:
Formatters in OS X v10.8 and iOS 6.0 use [version tr35-25].
Following that link:
s 1..2 12 Second. Use one or two for zero padding.
In other words, s for seconds means only the integral part.
But right underneath that, there's:
S 1..n 3456 Fractional Second - truncates (like other time fields) to the count of letters. (example shows display using pattern SSSS for seconds value 12.34567)
Then, the reason you aren't matching the timezone is that you're quoting the Z, so it matches a literal Z rather than a timezone format.
To match the ISO8601 timezone format you're seeing, the same documentation says you want ZZZZZ.
So, it looks like, at least for 10.8/iOS 6, you want:
[dateFormatter setDateFormat:#"yyyy-MM-dd'T'HH:mm:ss'.'SSSZZZZZ"]
For earlier versions, you've got the links to the docs; you should be able to figure it out now.
Testing this (in Python, to save a few lines of code):
>>> import Cocoa
>>> df = Cocoa.NSDateFormatter.alloc().init()
>>> df.setDateFormat_("yyyy-MM-dd'T'HH:mm:ss'.'SSSZZZZZ")
>>> print df.dateFromString_(2012-09-27T18:00:00.000-04:00')
2012-09-27 22:00:00 +0000

VB.Net Date String Format Patterns

DateTime.Now to Jul 31 10:20:30 PST 2012 format
DirectCast(row(0), DateTime).ToString("ddd MMM dd HH:mm:ss 'PST' yyyy")
row(0) is a string that is in the format 7/29/2012 1:25:20 PM
Keeps telling me the cast is incorrect, how can I correctly cast the string?
Awesome link for patterns for datetime.
You should be using DateTime.Parse, DateTime.TryParse, DateTime.ParseExact or DateTime.TryParseExact.
I suspect you could use CType instead of DirectCast, but personally I'd go for the method call - it makes it clearer what you're doing.

Need to parse a string to date without padded 0's

I've read through a lot of examples, but the problem I'm facing is the date I'm getting doesn't have leading 0's and all the objective-c stuff I've found has them. So I need to take the date:
4/9/2012 1:30 PM
And determine if it is today. My place was to either grab today's date and compare it to the first part of that string, but as I said before I can't find anyway to make a date in objective c without leading 0's. I'm hoping to avoid parsing that string manually to add leading 0's.
Use an NSDateFormatter object
[dateFormatter setDateFormat:#"h:mm a"];
if you want 0's
[dateFormatter setDateFormat:#"hh:mm a"];
I think that using the single M option for your date format string will allow it to parse a single digit month value:
The possible date formats are specified here
#ynistersix answer is correct. In Data Formatting Guide, they said that NSDateFormatter follows http://unicode.org/reports/tr35/tr35-dates.html
h 1..2 11 Hour [1-12]. When used in skeleton data or in a skeleton
passed in an API for flexible date pattern generation, it should match
the 12-hour-cycle format preferred by the locale (h or K); it should
not match a 24-hour-cycle format (H or k). Use hh for zero padding.
This is consistent with most other languages. Like .NET
"h" The hour, using a 12-hour clock from 1 to 12.
2009-06-15T01:45:30 -> 1
2009-06-15T13:45:30 -> 1
"hh" The hour, using a 12-hour clock from 01 to 12.
2009-06-15T01:45:30 -> 01
2009-06-15T13:45:30 -> 01