Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date manipulation in C++

Tags:

c++

date

I am sure that this kind of questions must have been asked before, but failed to find anything by searching this site. My apologies in advance if I missed any similar questions.

  1. Is there anything in C++ that just does date manipulation at all? I am aware of SYSTEMTIME structure (it is the structure returned when you do GetSystemTime I think) but it does not seem to contain any manipulation functions. For example, I am looking at something which can do "give me the day of the second Tuesday in July 2010". Also, fitting a time not sourced from the system clock into a SYSTEMTIME structure just seems, well, wrong.

  2. Is there any library routine to validate a date at all? I am not thinking about the basic "check day is between 1 and 28". The routine must be able to say that 29-02-2009 does not exist, for example.

Thank you.

like image 474
Andy Avatar asked Dec 29 '22 20:12

Andy


1 Answers

You should check out Boost::DateTime.

But to answer your question there is no date time 'handling' as such in C++

like image 79
Chris Huang-Leaver Avatar answered Jan 12 '23 02:01

Chris Huang-Leaver