Day of the week (dow) at DATE $ / TIME $.
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Day of the week (dow) at DATE $ / TIME $.
Dear nedudgi!
Nice to meet you on this forum too. Thank you for your comment.
Can you comment on the original problem?
Nice to meet you on this forum too. Thank you for your comment.
Can you comment on the original problem?
-
- Posts: 17
- Joined: Tue Feb 09, 2021 7:01 pm
- Location: Budapest, Hungary
- Has thanked: 61 times
- Been thanked: 2 times
Re: Day of the week (dow) at DATE $ / TIME $.
Yes, I googled meanwhile.
[url]http://sala.melda.info/doomsday.html[/url]
[url]https://www.geeksforgeeks.org/python-pr ... or-a-year/[/url]
[url]http://sala.melda.info/doomsday.html[/url]
[url]https://www.geeksforgeeks.org/python-pr ... or-a-year/[/url]
- Fernando Perez
- Posts: 378
- Joined: Mon Feb 15, 2021 10:09 pm
- Location: Santander (Spain)
- Has thanked: 195 times
- Been thanked: 267 times
Re: Day of the week (dow) at DATE $ / TIME $.
The day Google translator stops working, the Tower of Babel will fall again...
Tell me if this works for you the way you want it to:
I have added the cInt () function because I didn't take into account that dateUnix (Date$) adds seconds as the day progresses and does not return integer values.
Tell me if this works for you the way you want it to:
Code: [Local Link Removed for Guests]
DIM dayweek$(6) = "CSUTORTOK", "PENTEK", "SZOMBAT", "VASARNAP", "HETFO", "KEDD", "SZERDA"
i2c.Setup 4, 5 'SDA-->GPIO4, SCL-->GPIO5. Don't forget pull-up resistors!
lcd.Init 39, 20, 4
timer0 1000, cycle
wait
cycle:
if time$ = "00:00:00" then lcd.Cls ' A hét napja különböző hosszúságú lehet
nDay = cint(dateUnix(date$)/86400) MOD 7
nTemp = val(tempr$(2, 1)) ' DS18B20-->GPIO2. Don't forget pull-up resistor!
temp$ = str$(nTemp, "%3.2f") + " Cfok "
lcd.print 1, 1, date$(2) ' Hungarian format
lcd.Print 11, 1, dayweek$(nday)
lcd.print 1, 3, time$
lcd.print 11, 3, temp$
return
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Day of the week (dow) at DATE $ / TIME $.
Dear Fernando Perez!
Thanks for the help.
My question: Config / Time Zone: what value did you get? I need UTC + 02 (Hungary). Specifically: Config / Time Zone = CET-1CEST.
Thanks for the help.
My question: Config / Time Zone: what value did you get? I need UTC + 02 (Hungary). Specifically: Config / Time Zone = CET-1CEST.
- Fernando Perez
- Posts: 378
- Joined: Mon Feb 15, 2021 10:09 pm
- Location: Santander (Spain)
- Has thanked: 195 times
- Been thanked: 267 times
Re: Day of the week (dow) at DATE $ / TIME $.
If you refer to how to synchronize Annex with the NTP time server and calculate the time corresponding to your country, I have filled in the "Time Zone" box of the "Config" page with this value:
CET-1CEST,M3.5.0,M10.5.0/3
and press the "Save" button. You can check if it also works for your country if you enter these commands in the "Immediate" box on the "Editor" page:
Right now, I have this code running and it doesn't seem to have a problem:
Lucky!
CET-1CEST,M3.5.0,M10.5.0/3
and press the "Save" button. You can check if it also works for your country if you enter these commands in the "Immediate" box on the "Editor" page:
Code: [Local Link Removed for Guests]
wlog time$
option.ntpsync
wlog time$
Code: [Local Link Removed for Guests]
DIM dayweek$(6) = "Jueves", "Viernes", "Sabado", "Domingo", "Lunes", "Martes", "Miercoles"
dim a(8) = &h0e, &h11, &h11, &h0e, &h00, &h00, &h00, &h00
i2c.Setup 4, 5
lcd.Init 39, 20, 4
lcd.Custom 0, a()
timer0 1000, cycle
wait
cycle:
if time$ = "00:00:00" then lcd.Cls
nDay = cint(dateUnix(date$)/86400) MOD 7
nTemp = val(tempr$(2, 1))
temp$ = str$(nTemp, "%3.1f") + " "
lcd.print 2, 1, date$
lcd.Print 12, 1, dayweek$(nday)
lcd.print 2, 3, time$
lcd.print 12, 3, temp$
lcd.write 0
lcd.print 18, 3, "C"
return
You do not have the required permissions to view the files attached to this post.
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Day of the week (dow) at DATE $ / TIME $.
The Spanish version is elegant (° C).
The next project -> sensor: BME280
Question: Do you see the photo?
The next project -> sensor: BME280
Question: Do you see the photo?
- Fernando Perez
- Posts: 378
- Joined: Mon Feb 15, 2021 10:09 pm
- Location: Santander (Spain)
- Has thanked: 195 times
- Been thanked: 267 times
Re: Day of the week (dow) at DATE $ / TIME $.
Quick answer: NO. I only see this:
I'm sure there will be better methods to get it, but I use these in Windows 10:
Method A) If it is an image saved on my hard drive, I open it with Paint, Select Menu -> Select All-> Copy Icon. Next, I place the mouse cursor in the part of my answer in phpBB where I want to insert the image and Right Button-> Paste.
Method B) If it is an image that I am seeing on the screen, I open the snipping tool, capture the piece of image that I need and follow the procedure already mentioned to paste it into my message.
In any case, be careful to reduce the size of the image, if it is very large, before inserting it into the message.
With the "Preview" button you can see how it will look before the "Submit" button
I'm sure there will be better methods to get it, but I use these in Windows 10:
Method A) If it is an image saved on my hard drive, I open it with Paint, Select Menu -> Select All-> Copy Icon. Next, I place the mouse cursor in the part of my answer in phpBB where I want to insert the image and Right Button-> Paste.
Method B) If it is an image that I am seeing on the screen, I open the snipping tool, capture the piece of image that I need and follow the procedure already mentioned to paste it into my message.
In any case, be careful to reduce the size of the image, if it is very large, before inserting it into the message.
With the "Preview" button you can see how it will look before the "Submit" button
You do not have the required permissions to view the files attached to this post.
-
- Posts: 24
- Joined: Tue Mar 09, 2021 4:26 pm
- Location: Fót / Hungary
- Has thanked: 16 times
- Been thanked: 8 times
Re: Day of the week (dow) at DATE $ / TIME $.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 222
- Joined: Mon Feb 15, 2021 1:44 pm
- Has thanked: 125 times
- Been thanked: 132 times
Re: Day of the week (dow) at DATE $ / TIME $.
I knew I'd done this somewhere and I've just rediscovered the program.
I used http://worldtimeapi.org/ which will give you time and date information for any timezone.
With no parameters the API will check your location by IP address lookup.
This looks like it is privately supported and there is a message on the site about heavy loading. I have found fairly regular timeouts when accessing it so it's worth checking for the JSON 'not found' message and retrying if that's the case.
I used http://worldtimeapi.org/ which will give you time and date information for any timezone.
With no parameters the API will check your location by IP address lookup.
This looks like it is privately supported and there is a message on the site about heavy loading. I have found fairly regular timeouts when accessing it so it's worth checking for the JSON 'not found' message and retrying if that's the case.
Code: [Local Link Removed for Guests]
dim Day$(7) = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
gosub GetTimeDay
wait
GetTimeDay:
' Sunday is day 0
Line$ = WGET$( "worldtimeapi.org/api/ip", 80)
DayOfWeek$ = Day$(val(json$(Line$,"day_of_week")))
'wlog Line$
wlog DayOfWeek$
return
Last edited by AndyGadget on Thu May 13, 2021 9:24 pm, edited 1 time in total.