# Revision history [back]

### Convert string to date

So, I am at wits end on this question. I have a date picker in a writer document/form. I can read the chosen date easily enough (01/03/18). I can then break it down into a comma separated format easily enough (2018,01,03). Now the funk happens. When I try DateSerial() function it says no way - invalid function call. As overview, DateSerial(2018,01,03) works properly but a sting created using Left, Mid, Right will not work?

today = ThisComponent.Drawpage.Forms.getByName("Form").getByName("dteDatePick").tex

NewString= "20" + right(today,2) + ","
NewString = NewString + left(today,2)+ ","
NewString = NewString + mid(today,4,2)

Print trim(NewString) 'gives the correct response

MsgBox DateSerial(NewString) 'gives invalid procedure call

 2 None EasyTrieve 756 ●60 ●81 ●105

### Convert string to date

So, I am at wits end on this question. I have a date picker in a writer document/form. I can read the chosen date easily enough (01/03/18). I can then break it down into a comma separated format easily enough (2018,01,03). Now the funk happens. When I try DateSerial() function it says no way - invalid function call. As overview, DateSerial(2018,01,03) works properly but a sting string created using Left, Mid, Right will not work?

today = ThisComponent.Drawpage.Forms.getByName("Form").getByName("dteDatePick").tex

NewString= "20" + right(today,2) + ","
NewString = NewString + left(today,2)+ ","
NewString = NewString + mid(today,4,2)

Print trim(NewString) 'gives the correct response

MsgBox DateSerial(NewString) 'gives invalid procedure call