June 22, 20169 yr I am trying to convert text to date using GetAsDate function I referred to an old answer on below link: But I couldn't get it working , my system's date format is 2016-01-05 and I used the syntax: GetAsDate ( Right ( date_start_printing_text;4 ) & "-" & Left ( date_start_printing_text;3 ) & "-" & Middle ( date_start_printing_text ; 5 ; 2 ) ) to convert the value format 01-05-2016 date_start_printing_text is a calculation field, returns text value, which calculates its value from a text field with timestamp value using Left function Left ( timestamp_printing ; Position ( timestamp_printing ; " " ; 1 ; 1 )) Edited June 22, 20169 yr by dav1089
June 22, 20169 yr Well, if you look at the string you are trying to convert to date - i.e. the result of = Right ( date_start_printing_text;4 ) & "-" & Left ( date_start_printing_text;3 ) & "-" & Middle ( date_start_printing_text ; 5 ; 2 ) you will see that when the input is "01-05-2016" the output is "2016-01--5-" - so that's not going to work. I would also suggest you use the Date() function instead of GetAsDate() - that way the calculation does not depend on the date format being used by your file. Try = Date ( Left ( date_start_printing_text ; 2 ) ; Middle ( date_start_printing_text ; 4 ; 2 ) ; Right ( date_start_printing_text ; 4 ) ) -- P.S. Why do you need the date_start_printing_text field? You could extract the date components directly from the original timestamp string. Edited June 22, 20169 yr by comment
June 23, 20169 yr Author Hi, It works great .. and I used original timestamp string.. Thank you @comment
Create an account or sign in to comment