Split issues i am having people

Hi all :slight_smile:

30.12.1899 00:00:00

1 - How can i get the only date from this kind of string on the above like this → 30/12/1899

2 - I want to control the year if its smaller than 2023 i ll not write it to the excel sheet.

Thanks :robot:

@170290064

DateTime.ParseExact(dateString, "dd.MM.yyyy hh:mm:ss", System.Globalisation.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

@rlgandu ,

Here you go.

  1. DateTime.ParseExact(yourDateStringVariable, "dd.MM.yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")
  2. To control over year - check this way DateTime.ParseExact(yourDateStringVariable, "dd.MM.yyyy hh:mm:ss", System.Globalisation.CultureInfo.InvariantCulture).Year < 2023

Thanks,
Ashok :slight_smile:

image

:thinking:

The value’ type is already date not string…

In that case it’s more easy.

  1. yourDateVariable.ToString(“dd/MM/yyyy”)
  2. Check year like this - yourDateVariable.Year < 2023

Thanks,
Ashok :slight_smile:

1 Like

@170290064

Sequence22.zip (1.7 KB)

If your Input is date change it to

YourDateVariable.ToString("Your Format")

Please change the format as per your requirement

1 Like

Hi Eyüp Hasan Akbaba,

Here you can find the workflow with the solution.
Main.xaml (7.8 KB)

Hope it helps you!

1 Like

Hi @170290064

Try this way:

Assign dateString = "30.12.1899 00:00:00"
Assign dateValue = DateTime.ParseExact(dateString.Split(" "c)(0), "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture)

If dateValue.Year >= 2023
Then
    // Write to Excel sheet
Else
    // Skip writing

Hope it helps!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.