on 08-26-2013 8:47 AM
Hi,
I have this expression where I change a date format for my condition. But I can not test for dates I get Convertion error. here is my condition:
stringif(dateformat(datenow,"yyyy-MM-dd'T'hh:mm:ss","MMM_yyyy")=="Aug_2013", "true", "false") - it returns true but that is not how i need my condition.
I need to check if date is History, Present or Future date. I get conversion exception error when I use any date method e.g:
datecompare(dateformat(datenow,"yyyy-MM-dd'T'hh:mm:ss","MMM_yyyy")=="Aug_2013", "true", "false").
Any suggestions on how I can convert string "Aug_2013" to a date data type?
Hi Bheki:
1. convert the date you want to compare to xml date format:
datetoxmlformat(dateString, fromFormat)
2. then use the converted date with datenow:
datecompare(datenow, date2)
3. put all that together
datecompare(datenow,datetoxmlformat(dateString, fromFormat))
if you want to use first day of the month or last day of the month you can use the following functions:
monthend(date)
monthstart(date)
hope it helps,
Arnaud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Thanks Arnaud and Anuj for you input. It all worked well especially with the inclusion of monthstart function. It helped me where I wanted to test current date excluding time in hours and minutes.
You guys are grooming me as I am still young in XMII.
Thanks,
Bhekk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bheki,
In addition to what Arnaud said, all the date functions (datecompare,datediff etc) will work only with the dates in XML format i.e yyyy-MM-ddTHH:mm:ss. Please make sure you have converted the various date strings you want to play around with, in XML format using 'datetoxmlformat' function.
Best Regards,
Anuj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.