Fwd: Gnome date format issue




 Hi All,

I’m using below code to set the date in gnome date dialog box but getting different results in Centos 6 and Ubuntu 11 operating systems.

 

In Ubuntu, it is showing dates in weekday, day, month-name and year (Saturday 01 December 2012) instead of DD/MM/YY (01/12/12).

 

Please help me because I need to port my application to Ubuntu ASAP and due to this hurdle not able to proceed further.

 

void abc_set_date_to_GnomeDateEdit(GnomeDateEdit *gde,char* date)
{
    struct timeb tp1;struct tm * tsp1; struct tm mystructure;
    int day,month,year;
    char c_day[10],c_month[10],c_year[10];
   
    tsp1 = &mystructure;
    strncpy(c_day,date,2);c_day[2]='\0';
    strncpy(c_month,date+3,2);c_month[2]='\0';
    strncpy(c_year,date+6,4);c_year[4]='\0';
    day=atoi(c_day);
    month=atoi(c_month)-1;
    year=atoi(c_year)-1900;
    tsp1->tm_isdst=0;
    tsp1->tm_min=0;
    tsp1->tm_hour=0;
    tsp1->tm_sec=0;
    tsp1->tm_year = year;
    tsp1->tm_mon= month;
    tsp1->tm_mday = day ;
    tp1.time=mktime(tsp1);
    gnome_date_edit_set_time(gde, tp1.time);
}

OUTPUT IN UBUNTU (Incorrect output)

 

 

OUTPUT IN CENTOS 6(Correct output)

 

cid:6924D473-DF23-402B-BC43-9F6380077C69/centossnapshot1.jpg

 

Regards,

vivek

 







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]