How to extract day from date in watson conversation. The language is French.
I would like if $day=="Samedi" (in English => Saturday) or $day=="Dimanche" (in English => Sunday), the respond is "We do not work Saturday and Sunday"
Use the reformatDateTime('u')
to return the day of the week index . Then you can check for day 6 or 7. That would be even language-independent. The documentation for SimpleDateFormat indicates that the parameter should be F
, not u
to retrieve the index. Thus, you may want to experiment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.