Time in 24h format

Discuss RoboTask here
Post Reply
marcolobaido
Posts: 70
Joined: Thu Jul 02, 2015 3:54 pm

Time in 24h format

Post 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?
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Time in 24h format

Post 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)}
Oleg Yershov
marcolobaido
Posts: 70
Joined: Thu Jul 02, 2015 3:54 pm

Re: Time in 24h format

Post 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.
aa1508
Posts: 3
Joined: Thu Jul 25, 2019 7:43 pm

Re: Time in 24h format

Post 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
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Time in 24h format

Post 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"
Oleg Yershov
Post Reply