I am getting the error, stated in the title, with the following code:
ToText (Split ({?CutOffDate},"-") [2]),ToText (Split ({?CutOffDate},"-") [1]))
Please help fresh programmer find the problem!
Check first if this is a conversion issue, using the CDate function, as in here:
ToText(CDate({aString}), "dd-MMM-yy")
Don't forget the := assignment operator
EffectiveDateTimeString := ToText(CurrentDate + CurrentTime, "dd-MM-yyyy hh:mm:ss");
Related
I'm getting a "date" value of "20220916#120000" and I have no idea how to use carbon to better format these to separate date and times.
I'm still learning, but this is what I have so far:
$weather_date = Carbon::createFromFormat('Ymd#His', $weather->features[0]->properties->date)->format('jS F Y h:i:s');
but the response I see when dd($weather_data) is 'Unexpected data found)
Could anyone please offer guidance/advise on what I need to do in order to have the date and time available in a way in which I can query against.
Thank you.
There's more elegant solutions to this question, but the simplest solution is to replace the '#' with a '-'. It should be the fastest solution to the issue, but will require a comment for explanation
$dateStr = "20220916#120000";
$dateStr = \Str::replace("#", "-", $dateStr);
$weather_date = \Carbon\Carbon::createFromFormat('Ymd-His', $dateStr)->format('jS F Y h:i:s');
This is the more elegant solution to the problem; using regular expressions. It's easier to read, but the end result is the same.
$dateStr = "20220916#120000";
$dateTimeStr = preg_replace("/^(\d{4})(\d{2})(\d{2})#(\d{2})(\d{2})(\d{2})$/", '\1-\2-\3 \4:\5:06', $dateStr);
$weather_date = \Carbon\Carbon::parse($dateTimeStr)->format('jS F Y h:i:s');
I am trying to make a udf to replace the datediff function.
reason: the udf will end up in my very (close to 8192 limit) long formula.
I use the "dutch" vba therefor datediff is "datumverschil" (a long word)
I want to replace it with "dv"
but so far my dv udf is not working, and I cannot guess where the error
could be... the error says "error in value"...
this is what I have now:
Public Function dv(eerste As Date, tweede As Date, str As String) As Variant
dv = DateDiff(str, eerste, tweede)
End Function
who sees the error :) ? have a great sunday and thank you :) !
Im not sure about the language you are using, but normally each argument in a function has to go in order. Maybe this is your error?
In your code you have:
Public Function dv(eerste As Date, tweede As Date, str As String) As Variant
As you can probably see here, eerste goes first, tweede goes second, and str goes last.
So to pass the arguments through properly you would have to do:
dv(eerste, tweede, str)
Hope this solves your issue and have a nice day! :)
Edit:
I also noticed your function and your variable are named the same?
Again im not sure what language you are using, but it seems assigning DateDiff to the dv variable, you would be overwriting the function?
Perhaps you meant DateDiff = dv(eerste, tweede, str)
trying to print a loop over x for values of q, but keep getting this syntax error. Can anyone help with this?
Because it's a vector/array, not a single value. You may try the following:
np.set_printoptions(precision=2)
print(f'x = {x} -> q = {q}')
You could also take a look at numpy.array2string function.
I wanna return an array of value from multiple conditions.
Currently formula is set to accept one condition.
https://docs.google.com/spreadsheets/d/1pgVlBWYKWtT6AEPyRtZmAYdOXBCjYG_B7pdlvCqYq0A/edit?usp=sharing
The desired result is showed in the ad hoc worksheet
Edit : initial problem solved by player0. Thanks !
Previous post
I'm using curly brace to return an array of value with the IF formula. This works well. I wanted to use IFS function because i wanted to use more conditions.
With a similar table, only the 1st number is returned form the array.
I don't understand why.
https://docs.google.com/spreadsheets/d/1pgVlBWYKWtT6AEPyRtZmAYdOXBCjYG_B7pdlvCqYq0A/edit?usp=sharing
Thanks !
delete range E2:L and use this in E2:
=ARRAYFORMULA(TRANSPOSE(SPLIT(TRANSPOSE(QUERY(
IF((E1:L1=B2:B11)+(E1:L1=C2:C11)+(E1:L1=D2:D11);
"1;2;3;4;5;6;7"; ";");;9^9)); ";"; 1; 0)))
I will do an exam tomorrow, but now I can't run it, can anyone help me?? Thanks!!
program v2
uses
crt;
var
t, dongia: real;
begin
clrscr;
write('nhap t='); readln(t);
if dongia >= 100000 then
t:= 70 / 100 * dongia;
writeln('in don gia:'t);
readln;
end.
Add a semi colon (;) after the program name (so v2;)
Add a comma between the string literal and "t", so ( 'in don gia:',t )
as Roy says in the comments, the logic of your program is wrong. Dongia is uninitialized before the check.
Next time, add a problem description including errormessages and show that you spent some effort/thought in finding the problem.
Put parentheses around the IF condition:
if (dongia>=100000) then
and you should also put a comma in the writeln:
writeln('in don gia:', t);