the problem is, i have a dynamic database driven site, each data is entered with year, week etc.. 2 months ago assuming I'll create sort option in future i put everything, i.e year, week, hour, minute etc.. but forgot month. Now i'm adding sort option but i need month but not available
during database entry i use the following.
[PHP]
$year = date('Y');
$week = date('W');
$day = date('d');
$hour = date('H');
$minute = date('i');.[/PHP]
Any way to find month using week?
5 2839 Atli 5,058
Recognized Expert Expert
Hi.
How exactly is your table designed?
It would be far more efficient to use DateTime or TimeStamp to store dates. You can convert them into anything else with very little effort
figured out a way around it, problem solved. Thanks for your help :)
Want to share your solution with our members?
Ronald
oh sure!
You see i had the value of time() stored as id on all entries, i used time() to generate it so that i will have unique id's but it came in handy afterall i just used the value of id and found month.
example:
[PHP]date("m", 1192669707);[/PHP]
The thought occured to me when Atli mentioned TimeStamps. :)
Okay. Thanks for your explanation.
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: N8tor |
last post by:
I'm a programming neophyte so needless to say I need some help on some
VB scripting.
I need to create some code to find what month it will be this coming
Saturday. I also need to do the same for the week # of the month this
Saturday. And finally, the Year of the month this Saturday.
Could someone help me with this?
|
by: chennakeshava_ramesh |
last post by:
hi,
I have a problem, I am not able to find out which day of the week it
is using the calendar class.
I am using set() function to set the date
and want to find out which day i.e mon,tue etc of the week it is .
Can anyone help me out with this,
regards
|
by: SimonC |
last post by:
I would like to return data from the last 2 weeks of each given month
in Javascript, but in 2 formats.
So, the penultimate week (Monday to Sunday) and the last week (Monday
to ??)
I'm not sure if it can be done, but all help welcomed.
E.g. I have December and would like to see the last 2 weeks.. So this
doesnt mean the last 15 days. What i mean by this is...
|
by: Laguna |
last post by:
Hi Gurus,
I want to find the expiration date of stock options (3rd Friday of the
month) for an any give month and year. I have tried a few tricks with
the functions provided by the built-in module time, but the problem was
that the 9 element tuple need to be populated correctly. Can anyone
help me out on this one?
Thanks a bunch,
Laguna
|
by: Ante Perkovic |
last post by:
Hi,
How to declare datetime object and set it to my birthday, first or
last day of this month or any other date.
I can't find any examples in VS.NET help!
BTW, what is the difference between date and datetime classes?
Please, help
| |
by: Paul H |
last post by:
I have a db that stores people and their birth dates. On any given day, I
need to know who has a 40th birthday one month from now. I will only be
running the query on week days but of course some peoples 40th birthdays
will fall on Saturday and Sunday, I may also be out of the office on certain
days. So I need to "cast a net" to catch all birthdays "approximately" one
month from now, but that "approximation needs to be predictable.
How...
|
by: =?Utf-8?B?UGF1bA==?= |
last post by:
HI I have a stored procedure that returns data with a date field in the form
of a DateTime type. I need to place data in variables based on days of the
week starting with the first thursday of the month. So the week would be
week 1= (first thursday of the month through the next wed). So for example
for July 07 the first thursday is july5th so the first week would be thursday
july 5th , friday july 6th, sat july 7th, sun july 8th, mon...
|
by: Lado.Leskovec |
last post by:
Hi!
I'm writing a script that would sort some events and calculate the sum
of them all in the end of the month, which should be equal to the
number of days in a month. It seems to be working well, but for some
reason on march it calculates one hour less (30 days and 23:00:00) and
in october one hour more (31 days 1:00:00). I've tried different years
not just 2007. It's all the same. Anyone knows a good reason why this
might happen as it...
|
by: ezechiel |
last post by:
hi, I have the following error on a win server:
"Invalid Top Directory perl/lib/file/find.pm line 598
Here's the code and I'll explain what I found until now:
#!/usr/bin/perl
#
use strict;
use warnings;
use File::Find;
use MSDOS::Attrib qw(get_attribs set_attribs);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |