WP: WH-MDC05J3E5,WH-MDC07J3E5, WPB: Atlantic Explore v4, PV: Solaredge (6,8kW) en SMA (4,3kW), 2 x Heishamon OT v3.1, Rpi v5, Rpi v4, 2 x Rpi v3, ESP32, Domoticz, EV: Nissan Leaf,BYD Seal AWD, ESS: Deye 6K-SG03LP1, 2xLuyuan, 32kWh
Manual
>Date and time functions
>> date — format a local time/date
>> >
date -- format a local time/date
Description
string date(string format, int [timestamp] );
Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given.
The following characters are recognized in the format string:
a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D - day of the week, textual, 3 letters; i.e. "Fri"
F - month, textual, long; i.e. "January"
h - hour, 12-hour format; i.e. "01" to "12"
H - hour, 24-hour format; i.e. "00" to "23"
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
i - minutes; i.e. "00" to "59"
j - day of the month without leading zeros; i.e. "1" to "31"
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
L - boolean for whether it is a leap year; i.e. "0" or "1"
m - month; i.e. "01" to "12"
n - month without leading zeros; i.e. "1" to "12"
M - month, textual, 3 letters; i.e. "Jan"
s - seconds; i.e. "00" to "59"
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
t - number of days in the given month; i.e. "28" to "31"
U - seconds since the epoch
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y - year, 4 digits; i.e. "1999"
y - year, 2 digits; i.e. "99"
z - day of the year; i.e. "0" to "365"
Z - timezone offset in seconds (i.e. "-43200" to "43200")
Unrecognized characters in the format string will be printed as-is. The "Z" format will always return "0" when using gmdate()(). Example 1. date() example
print (date("l dS of F Y h:i:s A"));
print ("July 1, 2000 is on a " . date("l", mktime(0,0,0,7,1,2000)));
It is possible to use date() and mktime() together to find dates in the future or the past. Example 2. date() and mktime() example
$tomorrow = mktime(0,0,0,date("m") ,date("d")+1,date("Y"));
$lastmonth = mktime(0,0,0,date("m")-1,date("d"), date("Y"));
$nextyear = mktime(0,0,0,date("m"), date("d", date("Y")+1);
http://sms.toplyrics.net
>Date and time functions
>> date — format a local time/date
>> >
date -- format a local time/date
Description
string date(string format, int [timestamp] );
Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given.
The following characters are recognized in the format string:
a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D - day of the week, textual, 3 letters; i.e. "Fri"
F - month, textual, long; i.e. "January"
h - hour, 12-hour format; i.e. "01" to "12"
H - hour, 24-hour format; i.e. "00" to "23"
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
i - minutes; i.e. "00" to "59"
j - day of the month without leading zeros; i.e. "1" to "31"
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
L - boolean for whether it is a leap year; i.e. "0" or "1"
m - month; i.e. "01" to "12"
n - month without leading zeros; i.e. "1" to "12"
M - month, textual, 3 letters; i.e. "Jan"
s - seconds; i.e. "00" to "59"
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
t - number of days in the given month; i.e. "28" to "31"
U - seconds since the epoch
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y - year, 4 digits; i.e. "1999"
y - year, 2 digits; i.e. "99"
z - day of the year; i.e. "0" to "365"
Z - timezone offset in seconds (i.e. "-43200" to "43200")
Unrecognized characters in the format string will be printed as-is. The "Z" format will always return "0" when using gmdate()(). Example 1. date() example
print (date("l dS of F Y h:i:s A"));
print ("July 1, 2000 is on a " . date("l", mktime(0,0,0,7,1,2000)));
It is possible to use date() and mktime() together to find dates in the future or the past. Example 2. date() and mktime() example
$tomorrow = mktime(0,0,0,date("m") ,date("d")+1,date("Y"));
$lastmonth = mktime(0,0,0,date("m")-1,date("d"), date("Y"));
$nextyear = mktime(0,0,0,date("m"), date("d", date("Y")+1);
http://sms.toplyrics.net
Wat denk je van "date"?
echo date("d-m-Y", $timestamp);
Als je dat in het Nederlands wilt hebben, kun je met locales gaan klooien of je gooit alle namen in een array en haalt ze er dan uit op weekdagnr.
echo date("d-m-Y", $timestamp);
Als je dat in het Nederlands wilt hebben, kun je met locales gaan klooien of je gooit alle namen in een array en haalt ze er dan uit op weekdagnr.
Verwijderd
MySQL DATE_FORMAT() functions..!!!
DATE_FORMAT(date,format)
Formats the date value according to the format string. The following specifiers may be used in the format string:
%M
Month name (January..December)
%W
Weekday name (Sunday..Saturday)
%D
Day of the month with english suffix (1st, 2nd, 3rd, etc.)
%Y
Year, numeric, 4 digits
%y
Year, numeric, 2 digits
%X
Year for the week where Sunday is the first day of the week, numeric, 4 digits, used with '%V'
%x
Year for the week, where Monday is the first day of the week, numeric, 4 digits, used with '%v'
%a
Abbreviated weekday name (Sun..Sat)
%d
Day of the month, numeric (00..31)
%e
Day of the month, numeric (0..31)
%m
Month, numeric (01..12)
%c
Month, numeric (1..12)
%b
Abbreviated month name (Jan..Dec)
%j
Day of year (001..366)
%H
Hour (00..23)
%k
Hour (0..23)
%h
Hour (01..12)
%I
Hour (01..12)
%l
Hour (1..12)
%i
Minutes, numeric (00..59)
%r
Time, 12-hour (hh:mm:ss [AP]M)
%T
Time, 24-hour (hh:mm:ss)
%S
Seconds (00..59)
%s
Seconds (00..59)
%p
AM or PM
%w
Day of the week (0=Sunday..6=Saturday)
%U
Week (0..53), where Sunday is the first day of the week
%u
Week (0..53), where Monday is the first day of the week
%V
Week (1..53), where Sunday is the first day of the week. Used with '%X'
%v
Week (1..53), where Monday is the first day of the week. Used with '%x'
%%
A literal `%'.
All other characters are just copied to the result without interpretation.
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
-> 'Saturday October 1997'
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
-> '22:23:00'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%D %y %a %d %m %b %j');
-> '4th 97 Sat 04 10 Oct 277'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%H %k %I %r %T %S %w');
-> '22 22 10 10:23:00 PM 22:23:00 00 6'
mysql> select DATE_FORMAT('1999-01-01', '%X %V');
-> '1998 52'
As of MySQL 3.23, the % character is required before format specifier characters. In earlier versions of MySQL, % was optional.
Tja, je KAN er natuurlijk overheen gekeken hebben, maar dan heb je wel heel vroeg in de ochtend gekeken...;)
DATE_FORMAT(date,format)
Formats the date value according to the format string. The following specifiers may be used in the format string:
%M
Month name (January..December)
%W
Weekday name (Sunday..Saturday)
%D
Day of the month with english suffix (1st, 2nd, 3rd, etc.)
%Y
Year, numeric, 4 digits
%y
Year, numeric, 2 digits
%X
Year for the week where Sunday is the first day of the week, numeric, 4 digits, used with '%V'
%x
Year for the week, where Monday is the first day of the week, numeric, 4 digits, used with '%v'
%a
Abbreviated weekday name (Sun..Sat)
%d
Day of the month, numeric (00..31)
%e
Day of the month, numeric (0..31)
%m
Month, numeric (01..12)
%c
Month, numeric (1..12)
%b
Abbreviated month name (Jan..Dec)
%j
Day of year (001..366)
%H
Hour (00..23)
%k
Hour (0..23)
%h
Hour (01..12)
%I
Hour (01..12)
%l
Hour (1..12)
%i
Minutes, numeric (00..59)
%r
Time, 12-hour (hh:mm:ss [AP]M)
%T
Time, 24-hour (hh:mm:ss)
%S
Seconds (00..59)
%s
Seconds (00..59)
%p
AM or PM
%w
Day of the week (0=Sunday..6=Saturday)
%U
Week (0..53), where Sunday is the first day of the week
%u
Week (0..53), where Monday is the first day of the week
%V
Week (1..53), where Sunday is the first day of the week. Used with '%X'
%v
Week (1..53), where Monday is the first day of the week. Used with '%x'
%%
A literal `%'.
All other characters are just copied to the result without interpretation.
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
-> 'Saturday October 1997'
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
-> '22:23:00'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%D %y %a %d %m %b %j');
-> '4th 97 Sat 04 10 Oct 277'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%H %k %I %r %T %S %w');
-> '22 22 10 10:23:00 PM 22:23:00 00 6'
mysql> select DATE_FORMAT('1999-01-01', '%X %V');
-> '1998 52'
As of MySQL 3.23, the % character is required before format specifier characters. In earlier versions of MySQL, % was optional.
Tja, je KAN er natuurlijk overheen gekeken hebben, maar dan heb je wel heel vroeg in de ochtend gekeken...;)
Het spijt me maar ik ben al vanaf vanochtend 7 uur bezig dus ik zit er een beetje doorheen. Heel erg bedankt voor de snelle antwoorden.
PS Jammer dat de History van dit forum niet meer werkt of ligt dat aan mij?
PS Jammer dat de History van dit forum niet meer werkt of ligt dat aan mij?
WP: WH-MDC05J3E5,WH-MDC07J3E5, WPB: Atlantic Explore v4, PV: Solaredge (6,8kW) en SMA (4,3kW), 2 x Heishamon OT v3.1, Rpi v5, Rpi v4, 2 x Rpi v3, ESP32, Domoticz, EV: Nissan Leaf,BYD Seal AWD, ESS: Deye 6K-SG03LP1, 2xLuyuan, 32kWh
Euh, de search en daysprune werkt gewoon weer nu hoor
.
Anyway...The Daan raakt een beetje geïrri van die newbievragen he
I know
Anyway...The Daan raakt een beetje geïrri van die newbievragen he
I know
Verwijderd
Neuh, niet zozeer newbe vragen, maar meer om vragen die met 1 functie te doen zijn, 1 functie die gewoon mooi en duidelijk in de manual staan.
anyway, vragen over datums etc. worden veel gevraagd, terwijl zowel PHP als MySQL veel en goed gedocumenteerde functionaliteit heeft mbt dit onderwerp.
Zeker als dit soort vragen 3x per dag langskomen wordt ik daar wel eens een beetje triest van.
DE SEARCH DOET HET PRIMA NU!!
anyway, vragen over datums etc. worden veel gevraagd, terwijl zowel PHP als MySQL veel en goed gedocumenteerde functionaliteit heeft mbt dit onderwerp.
Zeker als dit soort vragen 3x per dag langskomen wordt ik daar wel eens een beetje triest van.
DE SEARCH DOET HET PRIMA NU!!
MySQL manual is idd niet echt de meest overzichtelijke die je je kunt voorstellen. Maar alle functies op alfabetische volgorde, daar zul je toch ook wel iets mee kunnen (ik zou wel uitkomen bij dateformat ofzo, lijkt me niet zooo moeilijk).
PHP manual heeft alle functies per categorie gegroepeerd en daarbinnen in alfabetische volgorde. Online heb je zelfs prachtige en vaak zeer bruikbare user comments, wat wil je nog meer?
PHP manual heeft alle functies per categorie gegroepeerd en daarbinnen in alfabetische volgorde. Online heb je zelfs prachtige en vaak zeer bruikbare user comments, wat wil je nog meer?
Verwijderd
<BLOCKQUOTE><font size=1 face=Verdana, Arial, Helvetica>quote:</font><HR>..,wat wil je nog meer?[/quote]Sommige willen graag alles voorgekauwd hebben door anderen, zodat ze niet zelf iets uit hoeven te zoeken. Ik bedoel hier niemand in het bijzonder mee, meer een algemene categorie die alles wil zonder er moeite voor te hoeven doen.
Anyway, deze discussie is al 100x gevoerd...
Anyway, deze discussie is al 100x gevoerd...
<BLOCKQUOTE><font size=1 face=Verdana, Arial, Helvetica>quote:</font><HR>Op 16 september 2000 12:31 schreef The Daan het volgende:
Alhoewel....:(
gezocht op time, date, datum, datetime, timestamp en ik krijg gewoon nix terug..
vreemd.[/quote]Het zoekscript werkt volgens mij heel simpel met iets van "SELECT FROM blaat WHERE header IS $zoekobject". Dan krijg je dus alleen resultaten waar de header identiek is aan je zoekobject. Als je zoekt met %zoekobject% bv. %timestamp% of %date% dan krijg je wel goeie resultaten...
Klein bugje dus?
Alhoewel....:(
gezocht op time, date, datum, datetime, timestamp en ik krijg gewoon nix terug..
vreemd.[/quote]Het zoekscript werkt volgens mij heel simpel met iets van "SELECT FROM blaat WHERE header IS $zoekobject". Dan krijg je dus alleen resultaten waar de header identiek is aan je zoekobject. Als je zoekt met %zoekobject% bv. %timestamp% of %date% dan krijg je wel goeie resultaten...
Klein bugje dus?
On track
Verwijderd
Nee, is geen bug, das gewoon logisch....alleen errug onhandig. Je bent verplicht om of wildcards te gebruiken of om de subject die je zoekt exact in te typen.
Niet echt een motivatie om de 'search' te gebruiken
Niet echt een motivatie om de 'search' te gebruiken
Als je het weet is het niet zo'n probleem. Alleen vind ik het niet echt logisch dat iedereen zomaar weet dat je %'s moet gebruiken.
Verwijderd
code:
1
2
3
4
| <?
$timestamp = "20020313125905";
echo date("d-m-Y", $timestamp);
?> |
Geeft bij mij: `18-01-2038`
Dis toch nie goed? Wat doet sambaatje verkeerd?
zo das ff een heftig zinloze kick
mysqltimestamp != phptimestamp
mysqltimestamp != phptimestamp
Doet iets met Cloud (MS/IBM)
Pagina: 1
Dit topic is gesloten.
![]()