ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 12:25pm
1
Hi Community
I cannot figure this one out.
I get the error when i try to convert at string i a have previously split and trimmed
You can see the converting assign activity gets the input: “13-02-2020” When looking in the local pane. So how is that I cannot convert it? heres how I convert:
Convert.ToDateTime(Datetime.ParseExact(newstring,“dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”))
Convert.ToDateTime(Datetime.ParseExact(newstring,“dd-MM-yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”))
Manish540
(Manish Shettigar)
February 13, 2020, 12:28pm
3
First check your input date is in which format.
lakshman
(Ganta lakshman)
February 13, 2020, 12:28pm
4
@ChrisPals
Try this. It will convert any type string date format to required string format.
CDate("inputStrDate").Tostring("dd-MM-yyyy")
7 Likes
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 12:38pm
5
I get the same error event though i dont split the string
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 12:40pm
7
Did you mean to convert the string to string? as shown below, in that case I recieve another error
Manish540
(Manish Shettigar)
February 13, 2020, 12:40pm
8
Display the input date in message box and send the screenshot of it.
Manish540
(Manish Shettigar)
February 13, 2020, 12:46pm
10
Not the type , display input date.
@ChrisPals I think it’s Better if you Display Like this :
“A”+newString+“B” inside the message Box
I know it’s weird but we get Confirmation of what is the real format in the String
lakshman
(Ganta lakshman)
February 13, 2020, 12:53pm
12
@ChrisPals
Remove double quotes and it should be like this.
newDateStr = CDate(newstring).Tostring("dd-MM-yyyy")
1 Like
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 1:00pm
14
Same issue unfortunately!
@ChrisPals Then the Expression what you had used to Convert Should be Fine, Can you Tell me what you want to do actually ? I can see your Converting String to Date but again you’re converting it into String , I Did’nt Understand Why?
@ChrisPals Can you just Check if this works :
Datetime.ParseExact(newstring,“dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”)
This worked fine for me
1 Like
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 1:08pm
17
get stringdate with get text>split so I only have the date and not the time>convert to datetime.
The assign converting from newstring to the datetime variable ‘lastedit’ should be the last step.
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 1:09pm
18
I tried that one.
But I recieve this error:
@ChrisPals If you want it in Date Type Format , Remove .ToString(“dd-MM-yyyy”)
1 Like
ChrisPals
(Christoffer Palsgaard)
February 13, 2020, 1:18pm
20
@supermanPunch
ah ok! thanks alot, It works perfectly now.
Cant believe I didn’t catch that myself