C
C#10mo ago
Raf Camora

✅ How do i get a one digit hour and not to digit for example i want the hours are 2 and not 02

28 Replies
Raf Camora
Raf CamoraOP10mo ago
in the output i get the hours 02 and not 2 if i type 10000 seconds
SG97
SG9710mo ago
oddly my WithSecure does not like that URL
Raf Camora
Raf CamoraOP10mo ago
well then i have to type the code here
SG97
SG9710mo ago
$paste
MODiX
MODiX10mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Raf Camora
Raf CamoraOP10mo ago
BlazeBin - ofspwjjmgxwr
A tool for sharing your source code with the world!
Raf Camora
Raf CamoraOP10mo ago
here is it does it work
SG97
SG9710mo ago
yup
Raf Camora
Raf CamoraOP10mo ago
okay
SG97
SG9710mo ago
you can get the values like ts.Hours / ts.Minutes / ts.Seconds as in Console.WriteLine($"{ts.Seconds}");
Raf Camora
Raf CamoraOP10mo ago
but can i also do this? Console.WriteLine($"Seconds: {ts.Seconds}");
Angius
Angius10mo ago
Not like this, no Yes Like this
Raf Camora
Raf CamoraOP10mo ago
yeah hahah but
SG97
SG9710mo ago
you can without the interpolation but it just looks bad Console.WriteLine("Hours: {0} ", ts.Hours);
Raf Camora
Raf CamoraOP10mo ago
ts.Hours / ts.Minutes / ts.Seconds; this line gives an error
SG97
SG9710mo ago
sure it does, as it's not code I'm just mentioning the properties
Angius
Angius10mo ago
It was just listing the values, not actual code lol
Raf Camora
Raf CamoraOP10mo ago
oh
MODiX
MODiX10mo ago
Angius
REPL Result: Success
var ts = TimeSpan.FromSeconds(10_000);
$"{ts.Hours} hours, {ts.Minutes} minutes, {ts.Seconds} seconds"
var ts = TimeSpan.FromSeconds(10_000);
$"{ts.Hours} hours, {ts.Minutes} minutes, {ts.Seconds} seconds"
Result: string
2 hours, 46 minutes, 40 seconds
2 hours, 46 minutes, 40 seconds
Compile: 364.148ms | Execution: 30.108ms | React with ❌ to remove this embed.
Raf Camora
Raf CamoraOP10mo ago
the seconds must be an input the user needs to write
Angius
Angius10mo ago
Then make it an input ¯\_(ツ)_/¯
SG97
SG9710mo ago
just replace it
Raf Camora
Raf CamoraOP10mo ago
okay
Angius
Angius10mo ago
I'm just showing the interpolation
SG97
SG9710mo ago
you already have tha portion of the code correct (not error free but still) take input, create the TimeSpan, use the properties like ZZZZZZZZZZZZZZZZZZZZZZZZZ showed
Raf Camora
Raf CamoraOP10mo ago
alright thanks bye !close
SG97
SG9710mo ago
take care
Accord
Accord10mo ago
Closed!
Want results from more Discord servers?
Add your server