i want to format date ,i have "2019-06-30T23:00:00" this format and i want to display 6/30,so how to format? - xamarin-forms-4

I want to format a date in xamarin form ,I have "2019-06-30T23:00:00"
this format ,I want to convert it to 6/30 ,
so how to convert .
I tried in xaml file with string format StringFormat='{}{0:dd.MM}'}
but nothing is working from xaml file

As a fast and simple workaround try this:
string str = "2019-06-30T23:00:00"; // code that gives you time
str = str.Substring(5,2)+"/"+str.Substring(8,2));
If you need better solution please specify how you retrieve the time.

Related

How I extract number from text in Google Data Studio?

I tried this but it's still showing null as you can see in the screen. Please help to solve this.
REGEXP_EXTRACT(X,"[0-9]*[0-9]")
It can be achieved using the Calculated Field below which uses the REGEXP_EXTRACT function to extract the numbers and the CAST function to ensure that it's a Number field:
CAST(REGEXP_EXTRACT(Attività, "(\\d+)") AS NUMBER )
Google Data Studio Report and GIF to elaborate:

PDI - Multiple file input based on date in filename

I'm working with a project using Kettle (PDI).
I have to input multiple file of .csv or .xls and insert it into DB.
The file name are AAMMDDBBBB, where AA is code for city and BBBB is code for shop. MMDD is date format like MM-DD. For example LA0326F5CA.csv.
The Regexp I use in the Input file steps look like LA.\*\\.csv or DT.*\\.xls, which is return all files to insert it into DB.
Can you indicate me how to select the files the file just for yesterday (based on the MMDD of the file name).
As you need some "complex" logic in your selection, you cannot filter based only on regexp. I suggest you first read all filenames, then filter the filenames based on their "age", then read the file based on the selected filenames.
In detail:
Use the Get File Names step with the same regexp you currently use (LA.*\.csv or DT.*\.xls). You may be more restrictive at that stage with a Regexp like LA\d\d\d\d.....csv, to ensure MM and DD are numbers, and DDDD is exactly 4 characters.
Filter based on the date. You can do this with a Java Filter, but it would be an order of magnitude easier to use a Javascript Script to compute the "age" of you file and then to use a Filter rows to keep only the file of yesterday.
To compute the age of the file, extract the MM and DD, you can use (other methods are available):
var regexp = filename.match(/..(\d\d)(\d\d).*/);
if(regexp){
var age = new Date() - new Date(2018, regexp[1], regexp[2]);
age = age /1000 /60 /60 /24;
};
If you are not familiar with Javascript regexp: the match will test
the filename against the regexp and keep the values of the parenthesis
in an array. If the test succeed (which you must explicitly check to
avoid run time failure), use the values of the match to compute the
corresponding date, and subtract the date of today to get the age.
This age is in milliseconds, which is converted in days.
Use the Text File Input and Excel Input with the option Accept file from previous step. Note that CSV Input does not have this option, but the more powerful Text File Input has.
well I change the Java Filter with Modified Java Script Value and its work fine now.
Another question, how can I increase the Performance and Speed of my current transformation(now I have 2 trans. for 2 cities)? My insert update make my tranformation to slow and need almost 1hour and 30min to process 500k row of data with alot of field(300mb) and my data not only this, if is it work more fast and my company like to used it, im gonna do it with 10TB of data/years and its alot of trans and rows. I need sugestion about it

ColeDateTime::Format languagespecific different fields

I want to format a COleDateTime as a CString, so i use
COleDateTime dt = GetMyDateTimeObj();
dt.Format(LOCALE_NOUSEROVERRIDE, GetCurrentLocaleID());
Since my program is multilanguage, GetCurrentLocaleID gives me the LCID currently selected (not in windows but in my program).
So the above gives me the correctly formated string according to the selected user-language but its always in a format "date-with-year + time-with-seconds". I think this is the short format of a date and the long format of the time accordong to windows regional settings.
What can i do to get the String with
- the year as just 2 numbers?
- completely without the year?
- the time-part without seconds?
Are there any switches to COleDateTime::Format that can give me year-as-2-digits, time-without-seconds but keeps fieldorder and separators specified by the LCID?
Of course i dont want to change any windows-regional-settings to do this and i dont want to use any fixed format-strings like _T("%d.%m.%Y %H:%M:%S") as this would break language-specific order of fields and separators.
Thanks for your hints and answers
Micha

Modify date time to a specific format

I'm having trouble coding a conversion to a specific time format along with converting to string format. I have the following code.
txtMonday->Text = Convert::ToString(dtpMondayIn->Value);
I want txtMonday(text box) not only to display dtpMondayIn's value(datetimepicker), but in h.mm format. Currently, it will display the date and time, for example, January 1, 2014 8:40:30 AM. I want the text box to show only 8.40 as in hours and minutes. How could I code this? I'm using Visual Studio 2012 and c++ language.
I am not really sure but
try this,
txtMonday->Text = Convert::ToString(dtpMondayIn->Value.ToString("hh:mm tt",CultureInfo.InvariantCulture));
OR
Convert::ToString(dtpMondayIn->Value.ToString("hh:mm",CultureInfo.InvariantCulture));
Also check DATETIME PICKER VALUE PROP
and DATETIME FORMATS
Let me know in case it works.

How to find current date of computer in ROS?

I'm trying to calculate difference of dates based on the current computer date, in ROS. Which function can I use to do that? Or atleast get the current date of computer.
Thanks in advance
You should try Google next time, but here:
ros::Time::now();
ros::Duration difference = ros::Time::now() - previous_time;
http://wiki.ros.org/roscpp/Overview/Time
EDIT:
To get a text string, you have to convert it: https://code.ros.org/trac/ros/ticket/2030
boost::posix_time thistime = from_time_t(difference);
Once you have it converted to boost::posix_time, you can:
std::string to_simple_string(thistime);
Which will spit it out like: "2002-Jan-01 10:00:01.123456789"
You can also see what thistime.date(); gives you, it looks like it might be simpler: http://www.boost.org/doc/libs/1_31_0/libs/date_time/doc/class_date.html