How to Convert a Date Into an Integer
- 1). Write out the number for the full year of the date. For example, the year in February 14, 2007, is "2007."
- 2). Write out the number for the month of the date. Lead with a zero if the month is a single digit. For example, February is the second month, so write "02."
- 3). Write out the number for the day. Lead with a zero if the day is a single digit. For example, the day in February 14 is "14."
- 4). Run all the numbers together. For example, the numbers for February 14, 2007, are 2007, 02 and 14, so it would convert to 20070214.
Source...