Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-07-22 02:17 PM
Unable to convert supplied value to a DateTime : Text value '29/07/2021 14:32' cannot be interpreted as a DateTime
Dear, I got this message when capturing this DateTime from a table. Does anyone know how I can resolve this?
------------------------------
Rafael Guerra
------------------------------
Dear, I got this message when capturing this DateTime from a table. Does anyone know how I can resolve this?
------------------------------
Rafael Guerra
------------------------------
Answered! Go to Answer.
1 BEST ANSWER
Helpful Answers
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-07-22 07:26 AM
Hi @RafaelGuerra
Try this two thinks:
- The name of the variable that you have as output parameter is DateTime, but "DateTime" is a key word from C#. Edit the name, for example "datDateTime" in both parts, in your code and in the output tab.
- Change the language of your VBO to C#. For this, go to the Initialise Page, double clic on the properties, and go to the Code Options tab, here change the Language to C#

Hope this helps you!
See you in the Community, bye 🙂
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
Try this two thinks:
- The name of the variable that you have as output parameter is DateTime, but "DateTime" is a key word from C#. Edit the name, for example "datDateTime" in both parts, in your code and in the output tab.
- Change the language of your VBO to C#. For this, go to the Initialise Page, double clic on the properties, and go to the Code Options tab, here change the Language to C#
Hope this helps you!
See you in the Community, bye 🙂
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-07-22 03:04 PM
Hi @RafaelGuerra
For this is better to use parse function.
Here you have the code to translate the text to the DateTime in your format:
For my example, datTime is the DateTime data item, and strDateTime my text source, Put this in a VBO using C# and is done
Hope this helps you!
See you in the community 🙂 Saludos
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
For this is better to use parse function.
Here you have the code to translate the text to the DateTime in your format:
datDateTime = DateTime.ParseExact(strDateTime, "dd/MM/yyyy HH:mm", null);
For my example, datTime is the DateTime data item, and strDateTime my text source, Put this in a VBO using C# and is done
Hope this helps you!
See you in the community 🙂 Saludos
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-07-22 03:12 PM
Dear Pablo, would that be a suggestion?
I've never needed to do a solution like this, so I'm really confused.
When I checkcode it gives an error.
------------------------------
Rafael Guerra
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-07-22 07:26 AM
Hi @RafaelGuerra
Try this two thinks:
- The name of the variable that you have as output parameter is DateTime, but "DateTime" is a key word from C#. Edit the name, for example "datDateTime" in both parts, in your code and in the output tab.
- Change the language of your VBO to C#. For this, go to the Initialise Page, double clic on the properties, and go to the Code Options tab, here change the Language to C#

Hope this helps you!
See you in the Community, bye 🙂
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
Try this two thinks:
- The name of the variable that you have as output parameter is DateTime, but "DateTime" is a key word from C#. Edit the name, for example "datDateTime" in both parts, in your code and in the output tab.
- Change the language of your VBO to C#. For this, go to the Initialise Page, double clic on the properties, and go to the Code Options tab, here change the Language to C#
Hope this helps you!
See you in the Community, bye 🙂
------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------
