I need to generate the incremental numbers based on date.
numbers created on a previous date (say 06-Jan-2014) should not be greater then numbers created on the coming dates (say 08-Jan-2014).
how to add it with date ?
I tried the down one but in few cases it is failing

```
static long num =1;
public long GetUniqueNumberAsPerDate(DateTime date)
{
    string dateStr = date.ToString("yyMMdd");
    long alwaysIncrementeduniqueNum = num + 1;

    return Convert.Int64(dateStr + alwaysIncrementeduniqueNum.ToString());
}

```

**Failing cases**

Date Passed : 2014-06-06
Num : 14
Number Created : 14060614

Date Passed : 2013-06-06
Num : 132
Number Created : 130606132 ( which is greater then 14060614)

The function can be called at same time by multiple applications. so the dateTime (even milliseconds) can be same
Any solution to this problem