How do I create UK dates from strings in Pharo Smalltalk?
pharo, smalltalk
Solution
Would this work for you?
Date readFrom: '04/02/2013' readStream pattern: 'dd/mm/yyyy'
Problem
I have some code that successfully parses strings to create dates: ``` date := string asDate ``` But this assumes US date format mm/dd/yyyy. I know I can output a date as a string in UK format like this: ``` date printFormat: #(1 2 3 $/ 1 1) ``` So my question, how do I create a date from a UK format date string dd/mm/yyyy? I've checked the String>>asDate method and this doesn't have any format parameter. Looking at Date class>>readFrom: (which asDate calls) it seems to have UK code in there, but how to dictate that this is what I want?