Parse Date Activity

activities

#1

Hi all,

Looking for some guidance on the correct way to use the Parse Date activity please.

I’m looping through rows in a data table (.csv source) & holding multiple dates as variables, which are all “mm/dd/yyyy” format.

I then need to call the variable in “dd/mm/yyyy” format, for input into a web based form.

Not sure how to correctly set the CultureName and DateTimeStyles properties…

Thanks in advance.


Changing Column Type to Date Format
#2

hello @dlp1980

Have you tried “Format Value” activity and let me know.

CultureName = Provides information about a specific culture (called a locale for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.

For E.g. for German culture you can out this into CultureName property “de-De”.

DateTimeStyles- Defines the formatting options that customize string parsing for some date and time parsing methods

For e.g. you can use “DateTimeStyles.NoCurrentDateDefault”(If the parsed string contains only the time and not the date, the parsing methods assume the Gregorian date with year = 1, month = 1, and day = 1. If this value is not used, the current date is assumed.)


For your reference:

CultureInfo MyCultureInfo = new CultureInfo(“de-DE”);
string MyString = “12 Juni 2008”;
DateTime MyDateTime = DateTime.Parse(MyString, MyCultureInfo,
DateTimeStyles.NoCurrentDateDefault);
Console.WriteLine(MyDateTime);

Regards,!!
Aksh


#3

See attached: StringToDateTime.xaml (6.0 KB)

You’re looking for

string strIn = "07/14/2015"    
dateTime dt = DateTime.ParseExact(strIn, "MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture)
string strOut = dt.ToString("dd/MM/yyyy")

#4

Thanks @Badita @aksh1yadav

So I can get it to work fine using Assign, which is cool.

Still curious on how to correctly use the Parse Date activity, just for my learning… here’s how I’ve filled out the Properties:

…but I get the following exception:

Any ideas?


#5

Hey

please find this attached sample workflow and let me know :slight_smile:

parsedate.xaml (6.0 KB)

Regards…!!
Aksh


Excel to CSV. Date format not the same
#6

All makes sense now, thanks guys!

I had misunderstood the purpose of Parse Date, that’s where I was going wrong… but on the right track now! Parse Date will be useful for some other data that I’m working with too.

Thanks again! :slight_smile:


#7

i am getting this error