Page 1 of 1

UNIX timestamp

Posted: Wed Sep 08, 2010 6:50 am
by rice1973
Hi Oleg,Is it possible to transform from "date / time" to "UNIX timestamp"?Example;"SepĀ  5 2010 11:47PM" should be converted to "1283723220
"Please advice.Best regards,Maurice

UNIX timestamp

Posted: Thu Sep 09, 2010 6:20 am
by Oleg
I have found the algorithm of conversion of date-time to UNIX, but I got another result.

"Sep 5, 2010 11:47PM" should be converted to 1283730420.
Check it, please, carefully.

You should use Evaluate action with expression:
(cdbl(#09/05/2010 11:47PM#) - 25569)*24*60*60

Also see the example, which can convert any datetime value:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|435362470
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task674"
Hide=INTEGER|0
ID=INTEGER|910626022
LocalVariables=STRING|"aaa,dt"
LogOnAsUser=INTEGER|1
Name=STRING|"Datetime to Unix1"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action1\Params]
password=STRING|"0"
prompt=STRING|"Input the date-time"
variable=STRING|"DT"

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

[Actions\Action2\Params]
expression=STRING|"(cdbl(cdate(""{dt}"")) - 25569)*24*60*60"
variable=STRING|"AAA"

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

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"{aaa}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

UNIX timestamp

Posted: Mon Sep 13, 2010 11:34 am
by rice1973
Hi Oleg,Imported task looks weird????Can you look??Best regards,Maurice

UNIX timestamp

Posted: Mon Sep 13, 2010 10:30 pm
by Oleg
You should copy only text in "code" section and save it as *.tsk file. Next you can import it.
I've tried this, everything is OK.

I can send this task to you via email, if it's necessary.

UNIX timestamp

Posted: Tue Sep 14, 2010 12:36 am
by rice1973
Hi Oleg,Still error see rar file for task en error message.http://www.sooco.nl/Robotask/Robotask.rarBest regards,Maurice

UNIX timestamp

Posted: Tue Sep 14, 2010 1:10 am
by Oleg
The task is correct. It uses Basic plugin. I thought that you have Basic already installed.
download and install it here
It's free.

If you want to make some complex or non-standard calculations, it's better to make this on Basic.