Page 1 of 1

Time in 24h format

Posted: Sat Jul 08, 2017 4:40 pm
by marcolobaido
Hi, I need to set an excel cell with a 24h time (15:30) but when I open the excel file it's written as 3:30:00 PM.
I had this problems with dates but I solved using DateTimeToFormat variable and it works.
Is there a way to impose also the 24h time format?

Re: Time in 24h format

Posted: Sun Jul 09, 2017 8:23 am
by Oleg
It seems the system date-time format is set to "American format" on your computer.
So Excel shows date-time values in default format in your system.

In order to transform to 24h format use the same function: DateTimeToFormat
Use the expression: {DateTimeToFormat({Time},hh:nn:ss)}
If you want to suppress seconds: {DateTimeToFormat({Time},hh:nn)}

Re: Time in 24h format

Posted: Mon Jul 10, 2017 8:42 am
by marcolobaido
Ok...I solved the problem:
I created a model file setting cells with format "personalized" "dd/mm/yyy or hh:mm etc...". Then I set cells with robotask without choosing the format and it works.

Re: Time in 24h format

Posted: Sun Mar 01, 2020 5:13 pm
by aa1508
would you please add an example on how to convert the 0.58333333333 (time extracted from excel) to 2:00 pm?
thank you

Re: Time in 24h format

Posted: Sun Mar 01, 2020 6:04 pm
by Oleg
Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1251730006
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task187"
Hide=INTEGER|0
ID=INTEGER|-756587506
LogOnAsUser=INTEGER|1
Name=STRING|"Set variable ""REALVAL"" with value ""0.58333333333""..."
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""REALVAL"" with value ""0.58333333333"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"REALVAL"
varvalue=STRING|"0.58333333333"

[Actions\Action2]
ActionID=STRING|"A_SCRIPT_VBEVALUATE"
Enabled=INTEGER|-1
Name=STRING|"VB Evaluate"
Params=FOLDER

[Actions\Action2\Params]
expression=STRING|"cdate({RealVal})"
linecount=STRING|"0"
loadfromfile=STRING|"1"
variable=STRING|"TimeVal"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show results"
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"{RealVal}"
msg1=STRING|"{TimeVal}"
msg2=STRING|"{DateTimeToFormat({TimeVal},hh:mm:ss am/pm)}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"