Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Format(Time time, bool seconds) problem
Format(Time time, bool seconds) problem [message #25642] Fri, 05 March 2010 12:34 Go to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello all

Now Format(Time) removes hour and minute when hour == minute == second == 0.

This affects too to EditTime control.

Would it be possible to remove this behavior or at least to add some parameter to avoid it ?

I am forced to have full date and time all the day.

String Format(Time time, bool seconds) {
	if(IsNull(time)) return String();
	String s = Format(Date(time));
	if(time.hour == 0 && time.minute == 0 && time.second == 0)
		return s;
	else
		return s + (seconds ? Format(" %02d:%02d:%02d", time.hour, time.minute, time.second)
	                        : Format(" %02d:%02d", time.hour, time.minute));
}


Thank you Smile


Best regards
Iñaki
Re: Format(Time time, bool seconds) problem [message #25699 is a reply to message #25642] Mon, 08 March 2010 17:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK. I hope this will cause any problems. But seems logical to me.

Mirek
Re: Format(Time time, bool seconds) problem [message #25704 is a reply to message #25699] Mon, 08 March 2010 20:57 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
luzr wrote on Mon, 08 March 2010 17:41

OK. I hope this will cause any problems. But seems logical to me.

Mirek

Hello Mirek

I would need an option to always display the full date and time.

If you do not want to change the code of Format(Time time, bool seconds), could you add a kind of .Pattern() function not just for EditDouble and so functions, but for EditTime ?


Best regards
Iñaki
Re: Format(Time time, bool seconds) problem [message #25713 is a reply to message #25704] Tue, 09 March 2010 08:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Mon, 08 March 2010 14:57

luzr wrote on Mon, 08 March 2010 17:41

OK. I hope this will cause any problems. But seems logical to me.

Mirek

Hello Mirek

I would need an option to always display the full date and time.

If you do not want to change the code of Format(Time time, bool seconds), could you add a kind of .Pattern() function not just for EditDouble and so functions, but for EditTime ?


Ah, I might not have been quite specific. I have changed the code as requested Smile

BTW, there are some settings for EditTime anyway. EditTime (as all Value specific Edits) inherits ConvertTime, so all ConvertTime methods are available.

Mirek
Re: Format(Time time, bool seconds) problem [message #25718 is a reply to message #25713] Tue, 09 March 2010 10:32 Go to previous message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Thank you Smile


Best regards
Iñaki
Previous Topic: FormatDouble and numbers under 1e-15
Next Topic: FindFile::IsExecutable() [Feature request]
Goto Forum:
  


Current Time: Mon Apr 29 18:12:43 CEST 2024

Total time taken to generate the page: 0.02100 seconds