automatic date and time picking -React Native - react-native

In React-native i want to automatically pick system date and time and display in two Textinput place. how can i do this? both time and date must assigned to variables.

you can use JS Date as usual
for example:
var currentdate = new Date();
var datetime = "Current date: " + currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " # "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();

Related

Continuations for Recurring Job

Since BackgroundJob doesn't have Add/Update, I try to work my way around with Recurring job and then set a Background Continuations that will Remove Recurring after it's first time generated. But it's not only remove, but also make my recurring job generate each second after the first generated.
[HttpGet("{day}/{month}/{hour}/{minute}/{second}/{jobID}")]
public string Get(int day, int month, int hour, int minute, int second, string jobID)
{
RecurringJob.AddOrUpdate(jobID, () => Console.WriteLine("At " + hour + " hour " + minute + " minute " +
second + " second, day "
+ day + " month " + month),
"*/" + second + " " + minute + " " + hour + " " + day + " " + month + " *", TimeZoneInfo.Local);
BackgroundJob.ContinueWith(jobID, () => RecurringJob.RemoveIfExists(jobID));
return "value";
}
Apparently Recurring job can't goes with Backgroundjob.ContinueWith. If I want to make it work like a schedule job and still able to update time span inside, I need to set a function to remove it along side.
[HttpGet("{day}/{month}/{hour}/{minute}/{second}/{jobID}")]
public string Get(int day, int month, int hour, int minute, int second, string jobID)
{
RecurringJob.AddOrUpdate(jobID, () => removeRecurring(jobID),
"*/" + second + " " + minute + " " + hour + " " + day + " " + month + " *", TimeZoneInfo.Local);
return "value";
}
public void removeRecurring(string jobId)
{
Console.WriteLine(DateTime.Now);
RecurringJob.RemoveIfExists(jobId);
}

token expression in flat file connection

I have loaded the variables in the format for example:
where produkt = 'Muj zivot2 R' and uraz = 'Uraz'
and I need the output in the file name to be:
Muj zivot2 R_Uraz
token worked for me, but it doesn't work in this case
" + TOKEN(" #[User::where] ","''",2) + "_" + TOKEN(" #[User::where] ","''",4) + "
You can use the following expression:
TOKEN(#[User::where],"'",2) + "_" + TOKEN(#[User::where],"'",4)
Output
Muj zivot2 R_Uraz

Dynamic dates in where parameter

Am I able to use a dynamic date range for the "where" parameter? I'd like to get all the data changed in the last 30 mins.
All I can find in the documentation is using static dates:
https://developer.xero.com/documentation/api/requests-and-responses
You could try using the query string in the Where Clause.
For Ex.
string querystr = "Date >= " +
"DateTime(" + dateFrom.Year.ToString() + ",
" + dateFrom.Month.ToString() + ", " + dateFrom.Day.ToString() + ") " +
"&& Date <= " +
"DateTime(" + dateTo.Year.ToString() + ", "
+ dateTo.Month.ToString() + ", " + dateTo.Day.ToString() + ")";
Passing this querystring to retrieve user defined date rage Invoices

How do I get the current date in GML?

I need to be able to get the current date, it doesn't really matter what format it is. Is there a function, or perhaps an API i can use?
You can get the current date a number of ways in GML. The easiest of which is probably using the variables current_second, current_minute, current_hour, current_day, current_weekday, current_month, current_year
Here's an example that draws the day, month, and year.
draw_text(32, 32, "Today is " + string(current_day) + "/" + string (current_month) + "/" + string(current_year) +".");
You can change the timezone using date_set_timezone(timezone);
The available timezones are timezone_utc and timezone_local.
Another way to get the date is using date_current_datetime();
myhour = date_get_hour(date_current_datetime());
myday = date_get_day(date_current_datetime());
It exists some ways to do it. If you only need to show the current datetime you can use this:
show_message("Today is " + string(current_day) + "/" + string (current_month) + "/" + string(current_year) + " - " + string(current_hour) + ":" + string(current_minute) + "." + string(current_second) +".");
This will return something like: "Today is 3/6/2017 - 23:40:15."

SQL to_date function

im modifying an oracle table using the following line of code:
db.execute("INSERT INTO "+dbOwner+"tbl_name VALUES('" + id+ "','" + studID+ "','"+"TO_DATE('"+ dateStr +"','MM/DD/YY)");
dateStr value: 2014-04-25
var now = new Date(),
dateStr = now.getFullYear() + "-",
monthCode = now.getMonth() + 1;
dateStr += ((monthCode < 10) ? ("0" + monthCode) : ("" + monthCode));
dateStr += "-" + ((now.getDate() < 10) ? ("0" + now.getDate()) : ("" + now.getDate()));
use bind variables. your insert statement will be 'visible'. there would be no problem to add quotes for variables (it will be automatic). and bonus: it is safer and faster.
Also, you can pass date as date, without transformation to/from string.
It will not work only for schema name (dbOwner).
according to what you write in the question
dateStr value is: 2014-04-25
so you should modify the date format in your code to be:
yyyy-MM-DD