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 » CalendarCtrl » DateTimeCtrl and format ddmmyyyy
DateTimeCtrl and format ddmmyyyy [message #9321] Thu, 26 April 2007 21:53 Go to next message
forlano is currently offline  forlano
Messages: 1049
Registered: March 2006
Location: Italy
Experienced Contributor
Hello,

I need a date from DateTimeCtrl in the format ddmmyyy, without "/". I tried

SetDateFormat("%3:02d%2:02d%1:4d"); // has been removed the '/'
date_field.SetData( date_field.GetData() );
SetDateScan("dmy");


But the background of the ctrl became red. I suspect it inherits some behaviour from the editctrl in which the number of characters in the ctrl should be 10 and not 8 as I want.
Is there a workaround?

Luigi
Re: DateTimeCtrl and format ddmmyyyy [message #9329 is a reply to message #9321] Fri, 27 April 2007 12:57 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
This is a bug/problem with Core function StrToDate. Specifically the problem is with the code:
		if(IsDigit(*s)) {
			char *q;
			n = strtoul(s, &q, 10);
			s = q;
		}

This normally reads the next number from the string s and stops when it encounters a non-digit char. When the date format doesn't include any non-digit characters it will just convert the whole string into a number, when the code that follows expects it to be a day, month or year number.

I can't see a workaround besides using non-digit characters as seperators. luzr?

[Updated on: Fri, 27 April 2007 13:01]

Report message to a moderator

Re: DateTimeCtrl and format ddmmyyyy [message #9345 is a reply to message #9329] Mon, 30 April 2007 11:20 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Actually, there is a way around this problem. You need to write your own Convert class to handle your date format and then do something like:
typedef EditValue<Date, MyDateConvert> EditMyDate;


Getting the same pop-up calendar functionality as the DateTimeCtrl is more difficult and requires some unorthodox type-casting, but it is possible.
Previous Topic: DataTimeCtrl and format dd/mm/yyyy
Next Topic: Small issues....
Goto Forum:
  


Current Time: Thu Apr 25 14:31:38 CEST 2019

Total time taken to generate the page: 0.00715 seconds