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ā€¦