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
Related
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
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
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."
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();
I am trying to filter a dataview based on two different columns: StartTime(DateTime) and EndTime(DateTime)...
Code:
Dim dvLosses As New DataView(dsLossData.Tables("AllData").DefaultView.ToTable(True, New String(){"ID", "Name", "StartTime", "EndTime", "Loss"}), "", "StartTime desc", DataViewRowState.CurrentRows)
dvLosses.RowFilter = "Where StartTime > '" + hfFrom.Value + "' and EndTime < '" + hfTo.Value + "'"
Error: Exception details: Syntax error: Missing operand after
'StartTime' operator. at System.Data.ExpressionParser.Parse() at
System.Data.DataExpression..ctor(DataTable table, String expression,
Type type) at System.Data.DataView.set_RowFilter(String value)
The RowFilter property is an expression more or less like the WHERE expression but it doesn't require the word WHERE. Just type the conditional expression
dvLosses.RowFilter = "StartTime > '" + hfFrom.Value +
"' and EndTime < '" + hfTo.Value + "'"
Instead I am more concerned on the fact that you treat two fields that appear to be a datetime as they were strings. If they are really datetime fields then you need a different syntax and quoting character
dvLosses.RowFilter = "StartTime > #" + hfFrom.Value.ToString("M/d/yyyy") +
"# and EndTime < #" + hfTo.Value.ToString("M/d/yyyy") + "#"
(Assuming that you hfFrom.Value and hfTo.Value are DateTime variables)
You can find more info on the syntax accepted by the RowFilter property looking at the Expression property of a DataColumn