Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Calendar week will be calculated wrongly by std::wcsftime function


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jan 27, 2016 2:26 PM Last Post By: Uffe Kousgaard
velrajan muthuvel

Posts: 28
Registered: 9/22/14
Calendar week will be calculated wrongly by std::wcsftime function  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 27, 2016 4:31 AM
If I am using the below code, I am getting the wrong week number. For ex: Jan 2,2016 ---> Week number is coming as "0" instead of 52

 time_t rawtime;
 struct tm * timeinfo;
 char buffer [80];
 
 time (&rawtime);
 timeinfo = localtime (&rawtime);
 
 strftime (buffer,80,"%W",timeinfo);
 swprintf(txt_buffer, L"%d", atoi(buffer));

Could you anyone suggest to help to get the week number using different function?

Uffe Kousgaard

Posts: 218
Registered: 2/7/00
Re: Calendar week will be calculated wrongly by std::wcsftime function
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 27, 2016 2:26 PM   in response to: velrajan muthuvel in response to: velrajan muthuvel
velrajan muthuvel wrote:

Could you anyone suggest to help to get the week number using
different function?

This is a delphi group. Try a c++ group.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02