Get difference between two dates?

the first post was almost correct
see my computer format is est 12/18/2017

now output which i want is from yesterday date with time be 12:00:00 AM (you can consider this as a string)

therefore output i want is this:

12/17/2017 12:00:00 AM; 12/16/2017 12:00:00 AM; 12/15/2017 12:00:00 AM; 12/14/2017 12:00:00 AM; 12/13/2017 12:00:00 AM; 12/12/2017 12:00:00 AM; 12/11/2017 12:00:00 AM; 12/10/2017 12:00:00 AM; 12/09/2017 12:00:00 AM; 12/08/2017 12:00:00 AM; 12/07/2017 12:00:00 AM; 12/06/2017 12:00:00 AM; 12/05/2017 12:00:00 AM; 12/04/2017 12:00:00 AM; 12/03/2017 12:00:00 AM

dude that was just a minor format change :slight_smile:
anyways see this : Get Last 15 Days datetime.xaml (8.0 KB)

Regards…!!
Aksh

thanks a ton bro it worked.12:00:00 AM i added at the output.

Sorry mate was busy i really forgot. that is also will work with format change…check now instead of appending.Get Last 15 Days datetime.xaml (8.0 KB)

date_time.ToString(“MM/dd/yyyy hh:mm:ss tt”,CultureInfo.InvariantCulture)

Regards…!!
Aksh

got it buddy thanks:)

hi bro now problem is i am not able to use this in other workflow.any particular reason?

Yes … u should import System.Globalization namespace in your project first.

Regards…!!
Aksh

hi i am new to this can u please tell me how.i am not able to pass the date as a string to other workflow .after invoking this one.Please!!

@1vivek12: academy all the way :slight_smile:

i have refered it but some how i am not able to pass the argument to other workflow dont know why

FYI: This code doesn’t work if you have different years. If you try for the difference between 1/1/2018 and 12/31/2017 you get 364 when it should be 1.

Hi,

try with DateDiff inside invoke code activity as following, it will give you correct result

date2 As Date = Date.Parse(“12/31/2017”)
date1 As Date = Date.Parse(“01/01/2018”)

’ Determine the number of days between the two dates.
days As Long = DateDiff(DateInterval.Day, date2, date1)

Hey need small help… i have many question in uipath since i am new . can you guide me how to raise that. Btw i have one question here :

I am copying date from SAP application but since copy activity will copy it as generic type. So i am finding it difficult to add 6(suppose) to that extracted date.

Can you please help me on both…

Thanks for the sample workflow…