[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] convert from 'date +"%H-%M %m-%d-%Y"' to seconds from 1970



Hi,

thanks, maybe my question was a bit misleading, I know there are a couple of ways to convert date formats into unix time and back. 

What I mean to do is put a 'human readable time' into a classadd: 

down.time = "2020-05-06 12:00" 

and use it for start calculations where I need it to be unix time, hence 

down.time.sec = abstime(down.time) 

Seems to be a way but I do not get it to work right now, maybe someone is using the abstime() function and can give me a hint, it needs to go into the startd_add obviously ...

best
christoph 

-- 
Christoph Beyer
DESY Hamburg
IT-Department

Notkestr. 85
Building 02b, Room 009
22607 Hamburg

phone:+49-(0)40-8998-2317
mail: christoph.beyer@xxxxxxx

----- UrsprÃngliche Mail -----
Von: "Stefano Dal Pra" <stefano.dalpra@xxxxxxxxxxxx>
An: "htcondor-users" <htcondor-users@xxxxxxxxxxx>, "Arne Babenhauserheide" <arne_bab@xxxxxx>
Gesendet: Dienstag, 5. Mai 2020 12:03:18
Betreff: Re: [HTCondor-users] convert from 'date +"%H-%M %m-%d-%Y"' to seconds from 1970

Hi,

Il 05/05/20 11:29, Arne Babenhauserheide ha scritto:
> Beyer, Christoph <christoph.beyer@xxxxxxx> writes:
>> maybe a stupid question, is there a way to translate a `date +"%H-%M %m-%d-%Y"` (or similar) into a HTC usable 'seconds-since-1970' maybe using time() or formatTime() inside a classadd string ?
>>
>> I know formatTime() works the other way round but I would like to do some START calculation based on a date given by the user which would be more conveniant to be in 'human readable' format ...
> Hereâs a long form:
>
> guile -c '(import (srfi srfi-19))(display (date->string (string->date "18-06 05-24-1983" "~H-~M ~m-~d-~Y") "~s\n"))'
>
> Iâm sure thereâs a shorter shell-command, but I donât have it at hand
> right now.

Maybe this one?

~$ date --date "2020-04-25 12:30" +%s
1587810600

Stefano


>
> Best wishes,
> Arne
_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/