Advertisement
sanpai

Convert SystemTime to Local Time

Jun 14th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <windows.h>
  2. #include <stdio.h>
  3.  
  4. //int ConvertUTCToLocalTime(SYSTEMTIME *SysTime,SYSTEMTIME *LocalTime )
  5. //{
  6. //
  7. //
  8. //
  9. //}
  10.  
  11. int main()
  12. {
  13. SYSTEMTIME st, lt;
  14. int retval;
  15. TIME_ZONE_INFORMATION TimeZoneInfo;
  16.  
  17. GetTimeZoneInformation( &TimeZoneInfo );
  18. GetSystemTime(&st);
  19. retval=SystemTimeToTzSpecificLocalTime(&TimeZoneInfo,&st,&lt);
  20.  
  21. if(retval)
  22. {
  23. printf("The function has succeeded = %d \n",retval);
  24. }else
  25. {
  26. printf("The function has failed = %d \n",retval);
  27. }
  28.  
  29. //GetLocalTime(&lt);
  30.  
  31. printf("The system time is: %02d:%02d\n", st.wHour, st.wMinute);
  32. printf(" The local time is: %02d:%02d\n", lt.wHour, lt.wMinute);
  33.  
  34. /*ConvertUTCToLocalTime(&st,&lt);*/
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement