Re: Epoch Seconds to YYYY-MM-DD
Re: Epoch Seconds to YYYY-MM-DD
- Subject: Re: Epoch Seconds to YYYY-MM-DD
- From: Emmanuel LEVY <email@hidden>
- Date: Sat, 27 Apr 2013 18:12:08 +0200
That's for one day, but then I suspect the problem is when the OT subtracts 86400:
set n to "1157445071"
set n to "" & (n - 86400)
-- "1.157358671E+9"
Since I suppose you would prefer a solution without an external addition, I would just trim the first digit (and force-inject it into the shell script).
set n to "157445071"
set n to "" & (n - 86400)
-- "157358671"
set n to "157445071"
do shell script "date -r 1" & n & " '+%Y-%m-%d'"
Emmanuel
On Apr 27, 2013, at 5:38 PM, Christopher Stone wrote:
> On Apr 27, 2013, at 10:25, Marconi <email@hidden> wrote:
>> I am trying to pass a number like "1157445071" to a shell script but AS keeps converting the passed value, such as "1157445071", to "1.157445071E+9" scientific notation.
>
> ______________________________________________________________________
>
> Hey Marconi,
>
> How are you generating your seed number?
>
> If you pass it as a string it should work fine:
>
> set n to "1157445071"
> do shell script "date -r " & n & " '+%Y-%m-%d'"
>
> --> "2006-09-05"
>
> --
> Best Regards,
> Chris
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden