Time() shows "" rather than the current time string [closed] - delphi

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
Uses DateUtils;
.....
var d:TDateTime;
begin
d:=Time();
ShowMessage(DateTostr(d));
end;
it shows "" rather than the current time string
Your comment welcome

You get odd results because Time returns a the date 1899-12-30 with the current time, and DateToStr returns the date as a string.
I question your claim that it shows an empty string though as it shows the following on my end:
So you either need to return the full date and time like this:
d := Now;
but note that if you show the date, you're still not showing the time, so instead you need to show the time portion of the TDateTime variable instead of the date portion:
ShowMessage(TimeToStr(d));

Related

Return a column range in which a string is in a cell [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 months ago.
Improve this question
Here is an example sheet:
https://docs.google.com/spreadsheets/d/1P91qqhClA8oO3-N9OGSxrFH-6lXxttZ3IN4bIGRGjHw/edit?usp=sharing
I am trying to get the column range returned in when the string in INPUT!B1 can be seen in DATABASE!A2:A into INPUT!C1:C3
You can use FILTER() function.
=FILTER(DATABASE!A:C,DATABASE!A:A=B1)
VLookup(), Index/Match(), QUERY() all these functions will work for you.

Initializer is misinterpreting the argument's data type [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am decoding data as shown on the right window and then using it to output a model via the initializer defined in the middle one. However, when I try to use it, I am being told that I am passing the wrong argument type.
Why is it that I am getting an error that the initializer is expecting a String, if I have defined it in the Model (the middle screen) to explicitly expect a [String] ?
Screenshot
The two of the arguments - genre and backgroundImage - are swapped, which causes the issue with the Initializer.

In Ruby, how do I find all the letters after the last number in a string? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm using Ruby 2.4. I have a string with letters and numbers, something like
str = "123abc234abb"
How do I find all the letters occurring after the last number in the string? For example, if I applied the function to the above, it would yield
abb
You could use a positive lookbehind:
"123abc234abb"[/(?<=\d)?[a-zA-Z]+\z/]
#=> "abb"
Try this
str.rpartition(/\d+/).last
How does this work?
rpartition splits the string into three parts, using reverse matching
last picks the post-match part from the three results

How to display datepicker selected value on label [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
procedure TForm1.DateTimePicker2Change(Sender: TObject);
var
day:tdatetime;
begin
Datetimepicker2.date:=day;
label1.caption:=(FormatDateTime('dd.mm.yyyy', day));
Hi!
I wanted to display selected date from datepicker on label but the label just show me the '30.12.1899' date of day and not the date which i selected from the datepicker.
Anyone have an idea? Thanks for the answers!
Your assignment should be reversed
day := Datetimepicker2.date;
You can also write that code without using local variable
procedure TForm1.DateTimePicker2Change(Sender: TObject);
begin
label1.caption:=(FormatDateTime('dd.mm.yyyy', Datetimepicker2.date));
end;

NSString contents changes from orginal text during object creation [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
This is the best reduced case of I am seeing
NSString * test = #"??( ";
NSLog(#"'%#'", test);
console> '['
I have a work around
NSString * test = #"\x3f\x3f(";
NSLog(#"'%#",test);
console> '??('
It seems like this is likely caused by string interpolation or similar process in the NSString object vivification. I'm posting this question for two reasons.
1) anyone happen to know what is actually causing this?
2) I didn't find anything on this 'feature' of NSString and it took me an hour to track down the bug, so this is just a bread crumb for future programmers. Using the hex code for the character was the work around.
NSlog("'%#'", test); is syntactically incorrect. How are you compiling it with this syntax error?
If I change it to NSLog(#"'%#'", test);, it works correctly (note the string literal denoting # and the uppercase L in NSLog).

Resources