From time to time, a user will need to pull a date from a string. More often than not it is from an XML or from some other location. In order to actually use this date passed, it needs to be of data type 'date' so it can be written to fields, used in queries etc. To do this, a user can use the 'str2Date' function. The str2Date function takes two parameters: datestring = The date in string format. It can be separated by either a dash ('-') or slash ('/') sequence = A three number combo using 1, 2, and 3 where 1 = day, 2 = month, and 3 = year. (e.g. 231 would be MM-YYY-DD, and 321 would be YYYY-MM-YY) If the sequence doesn't match the string or has an error, a '0' will result. Note that its very important to distinguish between day and month as an invalid month (>12) will result in a 0 and if both are <13, the date can translate totally wrong. I've detailed out the results of various scenarios below. Should be pretty self explan...
Blog mengenai tips dan trik soal komputer, gadget, dan software serta hardware