date ....?
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

date ....?

Started by dragos_sto, 05 June, 2005, 10:45:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dragos_sto

what it the syntax fot get date from the hub
hour and minute



dragos_sto

find sollution
os.clock ()
Returns an approximation of the amount of CPU time used by the program, in seconds.
os.date ([format [, time]])
Returns a string or a table containing date and time, formatted according to the given string
format.
If the time argument is present, this is the time to be formatted (see the os.time function for
a description of this value). Otherwise, date formats the current time.
If format starts with ‘!’, then the date is formatted in Coordinated Universal Time. After that
optional character, if format is *t, then date returns a table with the following fields: year (four
digits), month (1–12), day (1–31), hour (0–23), min (0–59), sec (0–61), wday (weekday, Sunday
is 1), yday (day of the year), and isdst (daylight saving flag, a boolean).
If format is not *t, then date returns the date as a string, formatted according with the same
rules as the C function strftime.
When called without arguments, date returns a reasonable date and time representation that depends
on the host system and on the current locale (that is, os.date() is equivalent to os.date("%c")).
• os.difftime (t2, t1)
Returns the number of seconds from time t1 to time t2. In Posix, Windows, and some other
systems, this value is exactly t2−t1.


and sorry post again in  wrong thread

plop

os.date("%x") -- returns the date.

os.clock is for the running time of the script.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

htb222

os.date("%H.%M) returns the hour and minute like this: 19.37 or 07.53.
C ya

plop

QuoteOriginally posted by htb222
os.date("%H.%M) returns the hour and minute like this: 19.37 or 07.53.
C ya
this can cause weird bugs.
imagine getting the time 1miliseconds before 12:00.
you call %H - returns 11.
next you call %M - returns 00.
now you run late for 1 hour.
always use 1 call when possible.
%X - returns the date.
%x - returns the time.
check the reference manual for all the others.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Madman

QuoteOriginally posted by plop
%X - returns the date.
%x - returns the time.
check the reference manual for all the others.

plop

Is init the other way around?
big X for time and small x for date?
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

dragos_sto

10x for answer
i found something
%H - hour
%M - minute
%T time (hour:minute:seconds)
%d - day
%m - month (arabic)
%h - month (letter)
%Y - year

and other but i dont know them :D

plop

%a	abbreviated weekday name (e.g., Wed)
%A	full weekday name (e.g., Wednesday)
%b	abbreviated month name (e.g., Sep)
%B	full month name (e.g., September)
%c	date and time (e.g., 09/16/98 23:48:10)
%d	day of the month (16) [01-31]
%H	hour, using a 24-hour clock (23) [00-23]
%I	hour, using a 12-hour clock (11) [01-12]
%M	minute (48) [00-59]
%m	month (09) [01-12]
%p	either "am" or "pm" (pm)
%S	second (10) [00-61]
%w	weekday (3) [0-6 = Sunday-Saturday]
%x	date (e.g., 09/16/98)
%X	time (e.g., 23:48:10)
%Y	full year (1998)
%y	two-digit year (98) [00-99]
%%	the character `%?
or click here

@madman: your right, i mixed them up.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk