Date in File Name

From Qt Wiki
Revision as of 15:14, 14 January 2015 by Maintenance script (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

English | Русский

Date in File Name

In the case you have to build a file name after the current date, so that it will look like data_mm_dd_yyyy.txt you can use the following simple function to get the string name of the file.

Or its shorter version that uses the overloading of the + operator for QString:

The fastest – and clearest – version, without calling a custom function, is

and when the files should get ordered chronological, then use