In order to calculate the numbers of days you will need to pass at least the year, month and the day. Here is a trick that uses the ObjectType function to attempt convert your date string to a valid YMDHMS format:
;Is there any one can help me or show me a sample code that will parse string date and get the date difference in days.
;sample date: 12/22/2012 then I want to get the difference in days. Basically I want to know if the date is older or lesser than 180 days(6 months) old from today's date.
;Possible date formats to be parsed 12/22/2012 or 2012 ( full date or just the year but I'm more concern of the full date)
strDate = "2012:12:22"
strDate = "12/22/2012"
strDate = "12-22-2012"
;Confirm we have a valid date string
; Requires at least a Year Month and Day vlaue
newstring = StrClean(strDate, ":/-", "", @FALSE, 2)
If StrLen(newstring) < 2
Pause( 'Notice','invalid date')
Exit
Endif
ymdDate = ObjectType("date", strDate)
ymdToday = TimeYmdHms() ; YYYY:MM:DD:HH:MM:SS
DiffDays = TimeDiffDays( ymdToday, ymdDate )
Message('Difference in Days', DiffDays)