Sunrise / sunset time

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

stevepiercy
Nevermind.  I was wrong.  I assumed there is a way to create a
datetime object with a designated timezone at the time of its
creation in Lasso 9, but it looks like all datetime objects use
the server's timezone.  meh.

So you can take the datetime string from the API (include the
date to deal with DST), determine your server's current offset
from GMT, make the necessary conversion of the datetime to the
server's timezone, then format the date for the local timezone.  
That makes my head hurt.

For something like this, I would shell out.  It makes it much
easier to convert a datetime between any two arbitrary timezones.
http://www.stevepiercy.com/articles/tz_convert-convert-datetime-types-between-time-zones-in-lasso-8/

--steve


On 5/14/15 at 6:40 PM, [hidden email] (Marc
Pinnell) pronounced:

>Was just looking at that page actually, but I don't see where
>it actually converts the time. That's just about output... right?
>
>marc
>
>
>On May 14, 2015, at 6:35 PM, Steve Piercy - Website Builder
><[hidden email]> wrote:
>
>>Hint: use locale.
>>http://www.lassosoft.com/lassoDocs/languageReference/obj/date
>>
>>--steve
>>
>>
>>On 5/14/15 at 6:16 PM, [hidden email] (Marc Pinnell) pronounced:
>>
>>>  Thanks for the offer. Jolle was right in that the api I
>>>referenced turned out to be  super simple to pull the time
>>>out of. Just tackling the UTC -> Pacific time
>conversions
>>> right now.
>>>   The API is returning "3:18:22 AM". According to
>>>weather.com sunset today is "8:18
>PM".
>>> Now how to convert... back to the docs!
>>>   marc
>>>    On May 14, 2015, at 5:49 PM, Bil Corry <[hidden email]> wrote:
>>>
>>>> I used a library to make an LCAPI module to calculate positions of the
>>>> planets.  The library can also calculate sunrise and sunset.
>>>>   http://www.astro.com/swisseph/swephinfo_e.htm
>>>>   I can dig up the LCAPI code, but I think it was for
>>>>LP8.5, if interested.
>>>>   - Bil
>>>>   On Thu, May 14, 2015 at 10:22 PM, Marc Pinnell <[hidden email]
>>>>> wrote:
>>>>
>>>>> Thought I would throw this out there before I spent the time reinventing.
>>>>> Looking for a tag (or basic code) to query "something" for the local time
>>>>> of sunrise / sunset. Took a quick look at TagSwap and LassoGuide and didn't
>>>>> see anything. This would be for a L9 project, but obviously any code would
>>>>> be adaptable.
>>>>>   I did find an api/service to query
>>>>>(http://sunrise-sunset.org/api), but
>>>>> thought I would ask the group if anyone has already done this. Thanks in
>>>>> advance.
>>>>>   marc
>>>>>    Marc Pinnell
>>>>> 1027 Design
>>>>> PO Box 990872
>>>>> Redding, CA 96099-0872
>>>>> 530.941.4706
>>>>> fax: 866.232.5300
>>>>> www.1027Design.com
>>>>>     #############################################################
>>>>>   This message is sent to you because you are subscribed to
>>>>> the mailing list Lasso [hidden email]
>>>>> Official list archives available at http://www.lassotalk.com
>>>>> To unsubscribe, E-mail to: <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>   #############################################################
>>>>   This message is sent to you because you are subscribed to
>>>> the mailing list Lasso [hidden email]
>>>> Official list archives available at http://www.lassotalk.com
>>>> To unsubscribe, E-mail to: <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>   Marc Pinnell
>>> 1027 Design
>>> PO Box 990872
>>> Redding, CA 96099-0872
>>> 530.941.4706
>>> fax: 866.232.5300
>>> www.1027Design.com
>>>     #############################################################
>>>   This message is sent to you because you are subscribed to
>>>  the mailing list Lasso [hidden email]
>>> Official list archives available at http://www.lassotalk.com
>>> To unsubscribe, E-mail to: <[hidden email]>
>>> Send administrative queries to  <[hidden email]>
>>
>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>Steve Piercy              Website Builder              Soquel, CA
>><[hidden email]>               <http://www.StevePiercy.com/>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>
>Marc Pinnell
>1027 Design
>PO Box 990872
>Redding, CA 96099-0872
>530.941.4706
>fax: 866.232.5300
>www.1027Design.com
>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Ke Carlton-3
Simply append the timezone to the date string being processed:

local(date) = date('2015-01-01 00:00:00UTC')
#date ' > ' #date->timezone '\n'
#date->timezone = 'Pacific/Auckland'
#date ' > ' #date->timezone '\n'

=> 2015-01-01 00:00:00GMT > Etc/GMT
=> 2015-01-01 13:00:00GMT+13 > Pacific/Auckland

These also work:

date('2015-01-01UTC')
date('2015-01-01+0800)

If there's no date to process, this is probably the best approach:

local(date) = date
#date->timezone = 'UTC'

Asides from that you can specify locales on creation.

Ke

On Fri, May 15, 2015 at 4:06 PM Steve Piercy - Website Builder <
[hidden email]> wrote:

> Nevermind.  I was wrong.  I assumed there is a way to create a
> datetime object with a designated timezone at the time of its
> creation in Lasso 9, but it looks like all datetime objects use
> the server's timezone.  meh.
>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Ke Carlton-3
Actually, you can do the equivalent of UTC / GMT like so:

local(date) =date(-dategmt)

Ke


On Fri, May 15, 2015 at 4:49 PM Ke Carlton <[hidden email]> wrote:

> Simply append the timezone to the date string being processed:
>
> local(date) = date('2015-01-01 00:00:00UTC')
> #date ' > ' #date->timezone '\n'
> #date->timezone = 'Pacific/Auckland'
> #date ' > ' #date->timezone '\n'
>
> => 2015-01-01 00:00:00GMT > Etc/GMT
> => 2015-01-01 13:00:00GMT+13 > Pacific/Auckland
>
> These also work:
>
> date('2015-01-01UTC')
> date('2015-01-01+0800)
>
> If there's no date to process, this is probably the best approach:
>
> local(date) = date
> #date->timezone = 'UTC'
>
> Asides from that you can specify locales on creation.
>
> Ke
>
> On Fri, May 15, 2015 at 4:06 PM Steve Piercy - Website Builder <
> [hidden email]> wrote:
>
>> Nevermind.  I was wrong.  I assumed there is a way to create a
>> datetime object with a designated timezone at the time of its
>> creation in Lasso 9, but it looks like all datetime objects use
>> the server's timezone.  meh.
>>
>>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

stevepiercy
In reply to this post by Ke Carlton-3
On 5/15/15 at 4:48 AM, [hidden email] (Ke Carlton) pronounced:

>Simply append the timezone to the date string being processed:
>
>local(date) = date('2015-01-01 00:00:00UTC')
>#date ' > ' #date->timezone '\n'
>#date->timezone = 'Pacific/Auckland'
>#date ' > ' #date->timezone '\n'
>
>=> 2015-01-01 00:00:00GMT > Etc/GMT
>=> 2015-01-01 13:00:00GMT+13 > Pacific/Auckland

Thanks.  That should have been obvious.

>Asides from that you can specify locales on creation.

This I have not been able to get to work.  What is the magic
syntax?  I've tried so many permutations, none of which work.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Ke Carlton-3
Haven't really used them — they never appealed. Thinking about it further,
I don't think they would help in this situation as they're effectively just
for formatting.

On Fri, May 15, 2015 at 4:53 PM Steve Piercy - Website Builder
>
>
> This I have not been able to get to work.  What is the magic
> syntax?  I've tried so many permutations, none of which work.
>
> --steve
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Marc Pinnell-3
In reply to this post by Ke Carlton-3
Figured this was the perfect answer... then I tried to apply it this morning without success. Did some digging and realized that last night I missed the format of the time. It is on a 12 hour clock. I thought the Lasso date tags would convert, but I am not having any success this morning.

local(date) = date('01/01/2015 10:53:18 PM')
#date->format('yyyy-MM-dd HH:mm:ss')
#date->asString

=> 2015-01-01 10:53:18
=> 01/01/2015 10:53:18

So it appears the PM is being dropped somehow. Can someone confirm or point out my bad assumption?

Marc



On May 14, 2015, at 9:48 PM, Ke Carlton <[hidden email]> wrote:

> Simply append the timezone to the date string being processed:
>
> local(date) = date('2015-01-01 00:00:00UTC')
> #date ' > ' #date->timezone '\n'
> #date->timezone = 'Pacific/Auckland'
> #date ' > ' #date->timezone '\n'
>
> => 2015-01-01 00:00:00GMT > Etc/GMT
> => 2015-01-01 13:00:00GMT+13 > Pacific/Auckland
>
> These also work:
>
> date('2015-01-01UTC')
> date('2015-01-01+0800)
>
> If there's no date to process, this is probably the best approach:
>
> local(date) = date
> #date->timezone = 'UTC'
>
> Asides from that you can specify locales on creation.
>
> Ke
>
> On Fri, May 15, 2015 at 4:06 PM Steve Piercy - Website Builder <
> [hidden email]> wrote:
>
>> Nevermind.  I was wrong.  I assumed there is a way to create a
>> datetime object with a designated timezone at the time of its
>> creation in Lasso 9, but it looks like all datetime objects use
>> the server's timezone.  meh.
>>
>>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

Marc Pinnell
1027 Design
PO Box 990872
Redding, CA 96099-0872
530.941.4706
fax: 866.232.5300
www.1027Design.com



#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Brad Lindsay
It looks like it’s not respecting the AM/PM marker to me. Not sure if that’s a supported date string configuration or not, but here’s how you can get around it:

local(date) = date('01/01/2015 10:53:18 PM', -format='MM/dd/yyyy hh:mm:ss a’)

HTH,
Brad

On May 15, 2015 at 1:17:14 PM, Marc Pinnell ([hidden email]) wrote:

> Figured this was the perfect answer... then I tried to apply it this morning without success.  
> Did some digging and realized that last night I missed the format of the time. It is on a  
> 12 hour clock. I thought the Lasso date tags would convert, but I am not having any success  
> this morning.
>  
> local(date) = date('01/01/2015 10:53:18 PM')
> #date->format('yyyy-MM-dd HH:mm:ss')
> #date->asString
>  
> => 2015-01-01 10:53:18
> => 01/01/2015 10:53:18
>  
> So it appears the PM is being dropped somehow. Can someone confirm or point out my bad assumption?  
>  
> Marc
>  
>  
>  
> On May 14, 2015, at 9:48 PM, Ke Carlton wrote:
>  
> > Simply append the timezone to the date string being processed:
> >
> > local(date) = date('2015-01-01 00:00:00UTC')
> > #date ' > ' #date->timezone '\n'
> > #date->timezone = 'Pacific/Auckland'
> > #date ' > ' #date->timezone '\n'
> >
> > => 2015-01-01 00:00:00GMT > Etc/GMT
> > => 2015-01-01 13:00:00GMT+13 > Pacific/Auckland
> >
> > These also work:
> >
> > date('2015-01-01UTC')
> > date('2015-01-01+0800)
> >
> > If there's no date to process, this is probably the best approach:
> >
> > local(date) = date
> > #date->timezone = 'UTC'
> >
> > Asides from that you can specify locales on creation.
> >
> > Ke
> >
> > On Fri, May 15, 2015 at 4:06 PM Steve Piercy - Website Builder <
> > [hidden email]> wrote:
> >
> >> Nevermind. I was wrong. I assumed there is a way to create a
> >> datetime object with a designated timezone at the time of its
> >> creation in Lasso 9, but it looks like all datetime objects use
> >> the server's timezone. meh.
> >>
> >>
> >
> > #############################################################
> >
> > This message is sent to you because you are subscribed to
> > the mailing list Lasso [hidden email]
> > Official list archives available at http://www.lassotalk.com
> > To unsubscribe, E-mail to:  
> > Send administrative queries to  
>  
> Marc Pinnell
> 1027 Design
> PO Box 990872
> Redding, CA 96099-0872
> 530.941.4706
> fax: 866.232.5300
> www.1027Design.com
>  
>  
>  
> #############################################################
>  
> This message is sent to you because you are subscribed to
> the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to:  
> Send administrative queries to  
>  


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Sunrise / sunset time

Marc Pinnell-3
Finally got it. A little ugly, but it works. Ended up writing a quick method to convert time strings like "10:53:18 PM" to "22:53:15". Then Ke's code worked.

Thanks guys!

Marc



On May 15, 2015, at 11:22 AM, Brad Lindsay <[hidden email]> wrote:

> It looks like it’s not respecting the AM/PM marker to me. Not sure if that’s a supported date string configuration or not, but here’s how you can get around it:
>
> local(date) = date('01/01/2015 10:53:18 PM', -format='MM/dd/yyyy hh:mm:ss a’)
>
> HTH,
> Brad
>
> On May 15, 2015 at 1:17:14 PM, Marc Pinnell ([hidden email]) wrote:
>> Figured this was the perfect answer... then I tried to apply it this morning without success.  
>> Did some digging and realized that last night I missed the format of the time. It is on a  
>> 12 hour clock. I thought the Lasso date tags would convert, but I am not having any success  
>> this morning.
>>
>> local(date) = date('01/01/2015 10:53:18 PM')
>> #date->format('yyyy-MM-dd HH:mm:ss')
>> #date->asString
>>
>> => 2015-01-01 10:53:18
>> => 01/01/2015 10:53:18
>>
>> So it appears the PM is being dropped somehow. Can someone confirm or point out my bad assumption?  
>>
>> Marc
>>
>>
>>
>> On May 14, 2015, at 9:48 PM, Ke Carlton wrote:
>>
>>> Simply append the timezone to the date string being processed:
>>>
>>> local(date) = date('2015-01-01 00:00:00UTC')
>>> #date ' > ' #date->timezone '\n'
>>> #date->timezone = 'Pacific/Auckland'
>>> #date ' > ' #date->timezone '\n'
>>>
>>> => 2015-01-01 00:00:00GMT > Etc/GMT
>>> => 2015-01-01 13:00:00GMT+13 > Pacific/Auckland
>>>
>>> These also work:
>>>
>>> date('2015-01-01UTC')
>>> date('2015-01-01+0800)
>>>
>>> If there's no date to process, this is probably the best approach:
>>>
>>> local(date) = date
>>> #date->timezone = 'UTC'
>>>
>>> Asides from that you can specify locales on creation.
>>>
>>> Ke
>>>
>>> On Fri, May 15, 2015 at 4:06 PM Steve Piercy - Website Builder <
>>> [hidden email]> wrote:
>>>
>>>> Nevermind. I was wrong. I assumed there is a way to create a
>>>> datetime object with a designated timezone at the time of its
>>>> creation in Lasso 9, but it looks like all datetime objects use
>>>> the server's timezone. meh.
>>>>
>>>>
>>>
>>> #############################################################
>>>
>>> This message is sent to you because you are subscribed to
>>> the mailing list Lasso [hidden email]
>>> Official list archives available at http://www.lassotalk.com
>>> To unsubscribe, E-mail to:  
>>> Send administrative queries to  
>>
>> Marc Pinnell
>> 1027 Design
>> PO Box 990872
>> Redding, CA 96099-0872
>> 530.941.4706
>> fax: 866.232.5300
>> www.1027Design.com
>>
>>
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>> the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to:  
>> Send administrative queries to  
>>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

Marc Pinnell
1027 Design
PO Box 990872
Redding, CA 96099-0872
530.941.4706
fax: 866.232.5300
www.1027Design.com



#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
12