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:
I've detailed out the results of various scenarios below. Should be pretty self explanatory so I won't go into too much additional detail. I included the output as well as the code used to get it. Kinda neat. Enjoy!
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)
I've detailed out the results of various scenarios below. Should be pretty self explanatory so I won't go into too much additional detail. I included the output as well as the code used to get it. Kinda neat. Enjoy!
Komentar
Posting Komentar