[perl(Script)] dag van de week uitlezen

Pagina: 1
Acties:

  • sharkzor
  • Registratie: Maart 2000
  • Laatst online: 09:17
ik heb een tabel afspraken waar natuurlijk ook een datum/tijd in staat. dit is in de standaard ms sql notatie (draait op ms sql 2000)
bv. 10-10-2002 20:30:00

nu wil ik afspraken gaan sorteren per dag (voorlopig alleen van de huidige week).
dat wil ik doen door 5 arrays te maken (ma t/m vrij) en die dan af te drukken (html output).

hoe ga ik uit die datum de dag vissen?


volgens mij kan ik zoiets doen:


($Seconds, $Minutes, $Hours, $DayInMonth,
$Month, $ShortYear, $DayOfWeek,
$DayOfYear, $IsDST) = localtime($epoch);

alleen hoe convert ik die mssql datum naar epoch standaard?
of is er ook nog een makkelijkere manier?

-edit owja moet erbij zeggen dak gezocht heb enzo.
kon in google geen manier vinden om mssql naar epoch te gooien

[ Voor 9% gewijzigd door sharkzor op 10-02-2005 15:23 ]


Verwijderd

In MySQL kan je UNIX_TIMESTAMP([date]) doen. Ik weet niet of dat ook met MSSQL kan.
There is no equivalent for UNIX_TIMESTAMP.

[ Voor 24% gewijzigd door Verwijderd op 10-02-2005 15:38 ]


  • Oezie Woezie
  • Registratie: December 1999
  • Niet online

Oezie Woezie

Pim. is de beste

$dow = Day_of_Week($year,$month,$day);

This function returns the number of the day of week of the given date.

The function returns "1" for Monday, "2" for Tuesday and so on until "7" for Sunday.

kan vrij makkelijk met Date::calc http://search.cpan.org/dist/Date-Calc/Calc.pod

een mooi Tshirt met Pim. is de beste enzo


  • jvhaarst
  • Registratie: Maart 2000
  • Laatst online: 13-05 09:49

jvhaarst

Eendracht maakt macht

Ik denk dat TS meer geholpen is met Time::Local
These routines are the inverse of built-in perl functions localtime() and gmtime(). They accept a date as a six-element array, and return the corresponding time(2) value in seconds since the system epoch (Midnight, January 1, 1970 GMT on Unix, for example). This value can be positive or negative, though POSIX only requires support for positive values, so dates before the system's epoch may not work on all operating systems.
of nog luier Date::Manip

[ Voor 9% gewijzigd door jvhaarst op 10-02-2005 20:12 ]

If you don’t have enough time, stop watching TV.