Jump to content
php.lv forumi

datumi


renathy

Recommended Posts

Man ir datums no MySQL db unix timestamp formātā. $date

Man ir dota nedēļas diena (skaitlis no 1-7). $day_of_week

Man ir jādabūn $nearest_date mainīgajā datums (bez laika), kurš ir tuvākais pēc $date un ir nedēļas dienā $day_of_week.

 

Kā to labāk izdarīt?

Link to comment
Share on other sites

ja glabatu datumu SQL formataa DATE tad tas buut pavisam vienkarshi --> paprastiitu lai atgriez datumu kas ir 1 nedelju atpakalj,

unix formataa arii to var izdariit, bet SQL tomer labak patiik savs formats (ja vajag pectam Unix formataa, tad uzreiz SQl kverejijaa arii var pankonverteet))

edit: nu jaa datumu unixtimestam var parekjinat vienkarshi datums=datums-(60*60*24*7) ...

Edited by Grey_Wolf
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...