How to Assign: Now.toString = "01/05/2023"

i want to make UiPath recognize Now.toString as my own hard coded date, like
Assign: Now.toString = “01/05/2023”

how to achieve this?

@wija
please follow
Now.ToString(“dd/MM/yyyy”)

if you want to go back one month then
DateTime.Now.AddMonths(-1).ToString(“dd/MM/yyyy”)

no, not like that, i already understand that

what i want is:
Screenshot 2023-06-14 165955

so whenever i call the code “Now.toString” in another flow, the UiPath not going to get true current date, but get my own hard coded date instead.

@wija you are writting wrong side of assign activity

i want
whenever i call the code “Now.toString” in another flow, the UiPath not going to get true current date, but get my own hard coded date instead.

@wija
Write right side of the assign activity and pass currently to Argument if you are using

if right side of assign is Now.toString(“dd/MM/yyyy”) then what is the left side of the assign? is the “01/05/2023” ?

@wija left side will be string variable where you will store value
like this
image

hi @wija

It should be some variablename of string type.
For eg:

currDate=Now.toString(“dd/MM/yyyy”)

sounds like

myDate = CDate(“01/05/2023”) - so my date will be the 5th Jan 2023

almost there, but i don’t want to manipulate variable myDate, what i want to manipulate is the code “Now.toString” it self

@wija
If you want to get previous month first day from now.tostring then
assign activity

→ Date1= DateTime(Date_Now.Year,Date_Now.Month,1).AddMonths(-1)

@wija I got your point you want to get previous month date First. Right?

no what i want is to manipulate “Now.toString” it self to be ANY hard coded date.

because i have so many flow that already using Now.toString not variable.
so whenever i call the code “Now.toString” the UiPath not getting true current date, but my own hard code date.

we recommend to recheck the code basics

Now is retrurning the current date
CDate is converting a string into a date

Using the Now for getting a date is not made for a usage to set Now to another date. If you feel that your question is not right understood then

  • recheck the essential programing concepts
  • then reformulate your case and elaborate more on what is to achieve

@wija ok.
the simply make a variable
then use assign activity and store like this
Date1=“01/05/2023”
and use this variable where Now.Tostring present

so what i want is not achievable.

and i have to revise all of my “Now.toString” to be using a variable first :frowning:

@ppr

@wija definately because “Now.ToString” command not a variable. That’s why you need to change everywhere where it is present

we adressed with

when you need a variable representing a particular date which is not the day of today then we would recommend to use one of the different string to datetime conversion methods for getting it

the thing is the project requirement is to get current date, so actually i don’t have revise any of my flow.
but my client not giving me any latest data for me to test it. i only have old data, so i have to roll back my “Now.toString”, but like what i stated in this posting, it is not achievable until i’m declare my “Now.toString” into a variable at a begining of my flow, then use the variable for the rest of my flow.