Jump to content

Recommended Posts

That's not going to work without the date in the correct format. (23/10/2011 will result in week 01, should be 42). You require the date as follows: YYYY-MM-DD

 

<?php
$a = '2011-10-23';
$week_num =  date('W', strtotime($a));
echo $week_num;
?>

 

Use the php manual to find answers

 

http://php.net/date

thanks for the correction neil. Schoolboy error on my behalf. kamal213, if you need to convert uk into a week number then one option is:

<?php
list($day,$month,$year) = explode('/','15/11/2011');
$weekNumber = date('W',mktime(0,0,0,$month,$day,$year));
echo $weekNumber;
?>

cheers

gristoi if you were a chick i'd marry you right now! lol

 

You last post is exactly what I was looking for!

 

Thanks aswell neil.johnson especially for correcting gristoi's error but for now I need the uk date format.

 

Thanks guys for your help I taught I would be really complicated but you both made it look simple.

 

Problem Solved!

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.