In angular material, used mat-datepicker for showing date picker.
I need to show custom date formatter in that date field.For custom date formatter, I have used material-moment-adpator. But I have ISO date format like this dd-MM-yyy. If use this date format, I get Tu-01-1990 output but I need to get a 10-01-1990.
How to convert iso date format to moment date format?
for "numeric" days, you should use DD instead of dd
Related
I am trying to change the date format of DateRange To and From Date I tried a lot but looks like I am missing something or amcharts not providing that kind of format.
Current Format
YYYY-MM-DD
Required Format
DD-MM-YYYY
JS Fiddle https://jsfiddle.net/hassanuos/Lmcphu4f/61/
It is possible to specify a format for these inputs: https://jsfiddle.net/1ox7zyde/
selector.inputDateFormat = "dd-MM-yyyy";
I have this date in actuall
2016-09-03 19:00:00 +0000
Now I am trying to convert it to String using a specific format like below
But what I am getting in return is not as desired. the formatter is adding on day to the given date like below
Is this standard behaviour ?
This is not standard behaviour. This happen because of the time zone difference. Set time zone proper
Set the timezone.
formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation: #"GMT"];
When you hover over the date, you can see that it is showing UTC, whereas the formatter is automatically converting this to a local date. If your timezone is 5 hours ahead of UTC, then it will be the next day locally from that time.
I would like to fetch results for selected date using SQLITE DB, and am getting date from uidatepicker and passing to fetch results method.
My sqlite query is following,
SELECT * FROM TRANSACTIONSHISTORY WHERE DATE > "21-09-2014 12:00:00" AND DATE < "22-09-2014 00:00:00"
But for that am getting results in 2015 year also, kindly help me to get out of this issue.
Your date is not in the correct format, if you check the documentation (http://www.sqlite.org/lang_datefunc.html) you will find this:
A time string can be in any of the following formats:
YYYY-MM-DD
YYYY-MM-DD HH:MM
YYYY-MM-DD HH:MM:SS
YYYY-MM-DD HH:MM:SS.SSS
YYYY-MM-DDTHH:MM
YYYY-MM-DDTHH:MM:SS
YYYY-MM-DDTHH:MM:SS.SSS
HH:MM
HH:MM:SS
HH:MM:SS.SSS
now
DDDDDDDDDD
If you make your date one of these formats, and run the query it will work:
SELECT * FROM TRANSACTIONSHISTORY WHERE date BETWEEN '2014-09-21' AND '2014-09-22'
I've got a date in the following format:
2013-05-04T05:07:09+00:00
I'm using MagicalRecord to map the NSDate automatically. As far as I can see the above date format should comply with MagicalRecord's default date format: yyyy-MM-dd'T'HH:mm:ss'Z'.
I have tried with a custom dateFormat entry in the attribute's user info (see this article):
yyyy-MM-ddTHH:mm:ss+Z, yyyy-MM-dd T HH:mm:ss Z, yyyy-MM-dd'T'HH:mm:ss'+'Z
but none of them work in order to have it parse the date properly and it always returns nil regardless of setting a custom dateFormat or using MagicalRecord's default format.
Let's look at your string:
2013-05-04T05:07:09+00:00
This is:
four digit year
hyphen
zero-padded month
hyphen
zero-padded day of month
'T' character
zero-padded hour
':' character
zero-padded minute
':' character
zero-padded second
timezone (with direction from GMT and a separating colon)
Thus, according to the date format specifiers documentation, the pattern you'd want is:
yyyy-MM-dd'T'HH:mm:ssZZZZZ
Also, be sure to use the en_US_POSIX locale with the NSDateFormatter.
Is it possible to format the output of NOW() to a string that displays YYYY-MM-DD?
This is the output of NOW(): 29/02/2012 12.07.37
The reason is, that I need to use the current date in a QUERY.
QUERY only accepts date in the format YYYY-MM-DD . I can't get a date directly from a cell, because it gets formatted as (even if I change the formatting): DD/MM/YYYY
Perhaps some regular expression?
If this is supposed to be an in-cell formula then you can use
=TEXT(NOW(),"yyyy-mm-dd")
I will follow JMax's suggestion and convert my comment to an answer.
Now() returns the current date and time as a number. The integer part gives the date and the fraction part gives the time. If you print or display that date, the default is to give the full date in what Microsoft think's is the local format.
Format(expn, fmt) allows you to convert an expression to a string. For example:
Dim DateStg as String
DateStg = Format(Now(),"yyyy-mm-dd")
fmt defines the format to which the expn is to be converted. fmt is a mixture of code letters (such as: "yyyy", "mm", "dd") and punctuation (such as "-"). "yyyy-mm-dd" appears to meet your current needs but you can also usethe following to format dates:
"mmm" to give three letter month (Jan, Feb, etc.)
"mmmm" to give full name of month (January, February, etc)
"ddd" to give three letter day of week (Mon, Tue, etc)
"dddd" to give full name of day of week (Monday, Tuesday, etc)
In VB.net you can do the following:
Dim dateStr As String = Now().ToString("yyyy-MM-dd")
In C# you can do it like this:
String dateStr = DateTime.Now.ToString("yyyy-MM-dd");