Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* \file DateTools.h
* 22/01/2010 KR Initial implementation
*/
#ifndef DATETOOLS_H
#define DATETOOLS_H
#include "StringTools.h"
#include <string>
/**
* Converts three integers representing a date into a double.
* Note: It is not really checked if the date actually makes sense.
*/
double date2Double(int y, int m, int d);
/**
* Converts a double representing a date into a string.
* Note: It is not really checked if the date actually makes sense.
* \param ddate Number containing date in double format yyyymmdd
* \return A string containing the date in format "dd.mm.yyyy".
*/
std::string date2string(double ddate);
/**
* Converts a string containing a date into a double.
* Note: It is not really checked if the date actually makes sense.
* \param s String containing the date, the expected format is "dd.mm.yyyy".
* \return A number representing the date as dd.mm.yyyy.
*/
double strDate2double(const std::string &s);
/**
* Converts a string containing a date into a double.
* Note: It is not really checked if the date actually makes sense.
* \param s String containing the date, the expected format is conform to the xml date type, i.e. "yyyy-mm-dd".
* \return A number representing the date as yyyymmdd.
*/
double xmlDate2double(const std::string &s);
#endif //DATETOOLS_H