DateTime in Flutter - flutter

I was importing internationalization for my app but I have a problem where I parse my String but it only returns the date and not the time. When I change the phone language, my format for the Date changes but my Time isn't showing.
This is when it is EN_US
This is when it is EU(German)
That works well but my time format is missing...
This is the default String from the API:
Here is the code:
/// I set a variable that calls the locale of the phone language and changes according to the phone preference
final f = DateFormat.yMd(Localizations.localeOf(context).languageCode);
/// where I dispay time and date but only date is shown in the pictures above
Text('Time and date: ${f.format(DateTime.parse(apicall.dateCreated))}');
My questions are: How do I show the time and how can I swap between showing the Time first then the Date, and opposite, if I want to show the Date first then the Time? (example 18-May-21 11:10h and if I want to do this 11:10h 18-May-21)
Thanks in advance for the help!

I suppose you should use DateFormat.jm().add_yMd(): this will show time first and then date. To swap it just use DateFormat.yMd().add_jm()
More info here

Related

Rundeck time format

In the "Activity for jobs' page in Rundeck the execution time has a relative time field (example: "Today at 10:15 AM" or "Last Sunday at 4:51 AM") after the timestamp.
It is easy to change the date format of the timestamp by adding jobslist...format[.ko] in the i18n/messages.properties file.
It seems impossible however to change the format of the relative time message. It seems to be hard-coded in en_US with AM/PM which doesn't look too good in in non-English-speaking countries. The format is always the same regardless of the ?lang=xx parameter or the default language in the browser. Interestingly, other objects (like hovering over the field with the mouse and the duration get translated).
Has anyone successfully changed this?
Example. See the duration field
I have been trying this with the docker images (4.8.0, 4.9.0 and SNAPSHOT)
I've looked at the source code and apparently this lies somewhere in the moment.js code.
In some parts, the date formats are hard coded as you say, please add your use case on this thread.

Get correct date from excell on flutter

Hello guys I'm having a little hard time figuring this out.
So I have a small excell that I'm putting some information there(adding and requesting)
The problem is when I'm trying to get the date as string, and add it as DateTime.
Always the same error "Invalid Date Format"-
I have my dates on excell, as Simple Text saved as "20-06-2022", and displaying that on flutter with "user[index].date", all ok. The problem is that I want to compare the dates with a random day.
I've tried
DateTime.parse(users[index].date); // not working
Text(users[index].date); // not working ( shows random numbers as 44734)
The DateTime.parse method only accepts specific formats that are listed in the documentation.
Since yours is not one of those, you need to create a DateFormat instance of your own and use that one to parse
void main() {
final text = '20-06-2022';
final format = DateFormat('dd.MM.yyyy');
final date = format.parse(text);
print(date);
}

How to display date and time with timezone in flutter

I need to display the date ,time and time zone in given format "2020-07-08T02:44:58 +05:30".
I could display time and date but couldn't display timezone along with that.help please
You can use the function DateTime.now().timeZoneName that will output the timezone's name (EST, PST) if you need further enhancements, you could try this library: https://pub.dev/packages/flutter_native_timezone
I found the answer for getting timestamp for flutter.I used package date_format 1.0.8 https://pub.dev/packages/date_format. The package helps me to meet my requirement.

How can I compare and check date of program and the system date in MVS 2012 Coded UI test?

I am trying to compare and check the date if it is today's date or not in a spesific program. I tried to use assertion method but when I use it the time will remain same if you try it next day. The main problem that I need to know when open a page from program It should be today's date and should be passed. if you know already anything about it please let me know also :)
Thanks yo!
Use System.DateTime.Now.ToString("yyyy-MM-dd") as one argument of the assertion. You may need to use a different format rather in the ...ToString() method. The exact format depends on how the date is shown on the screen.
This could be done using "StringAssert" to verify that your programs date string contains today's date string, while ignoring the time:
var programDateString = "7/25/2016 12:00:00"; //this is an example of your date retrieved from the application with time included
var todaysDate = System.DateTime.Today.ToShortDateString(); //short date string
StringAssert.Contains(programDateString, todaysDate);

migx TV (MODx REVO) - date format

I have a problem: I cannot bring date without time through MIGX TV
created by TV type migx:
{«Field»: «Date», «caption»: «Date», «inputTVtype»: «date»}
I deduce that everything appears normal by this way [[+ date]], but it is displayed as date and time and I want to display only the date part!
I tried this [[+ date: date ="% Y-% m-% d"]] but instead of the correct date 1/1/1970 is displayed.
I understand that the problem is that I use the TV type migx, but I need to use migx because there can be lots of dates!
Help me, please!
http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 - you need :strtotime modificator before :date -
[[+mydate:strtotime:date=`%Y-%m-%d`]]