Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

DateTimeFormat : getDayName return an Access Violation

Moderators: kris

Posted: 11/23/08 00:43:55

Hello,

I don't know if I'm wrong in my code or if it's a bug :

import 
	tango.io.Stdout
	,tango.text.locale.Core
	,tango.time.chrono.Calendar
	;


void main()
{
 
 DateTimeFormat dtFormat = new DateTimeFormat;
 
 Calendar.DayOfWeek dayOfWeek = dtFormat.firstDayOfWeek;

 Stdout(dtFormat.getDayName(dayOfWeek)).newline;
  
}

The execution return the error :

object.Exception: Access Violation     

Thanks for your help, TSalm

Author Message

Posted: 11/23/08 09:59:42 -- Modified: 11/23/08 10:00:54 by
tsalm

Oops, "DateTimeFormat?.current" must be use instead of "new DateTimeFormat?"

The good code is :

import 
	tango.io.Stdout
	,tango.text.locale.Core
	,tango.time.chrono.Calendar
	;


void main()
{
 
 DateTimeFormat dtFormat = DateTimeFormat.current;
 
 Calendar.DayOfWeek dayOfWeek = dtFormat.firstDayOfWeek;

 Stdout(dtFormat.getDayName(dayOfWeek)).newline;
  
}

Posted: 11/24/08 18:56:29

You should still be able to create your own DateTimeFormat.

Please submit a ticket.

Posted: 12/07/08 01:44:52

Done ( one month later, but done ! _ )
http://www.dsource.org/projects/tango/ticket/1392#preview