473,671 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

find month, have hour, minute, day, week and year

59 New Member
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?
Oct 18 '07 #1
5 2831
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
Oct 18 '07 #2
cssExp
59 New Member
figured out a way around it, problem solved. Thanks for your help :)
Oct 19 '07 #3
ronverdonk
4,258 Recognized Expert Specialist
Want to share your solution with our members?

Ronald
Oct 19 '07 #4
cssExp
59 New Member
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. :)
Oct 19 '07 #5
ronverdonk
4,258 Recognized Expert Specialist
Okay. Thanks for your explanation.

Ronald
Oct 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
6782
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?
4
5728
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
13
3596
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...
20
5029
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
6
8977
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
2
2339
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...
6
4224
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...
5
1640
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...
11
7406
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);
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
jinu1996
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...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7437
agi2029
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...
1
6229
isladogs
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...
0
5696
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();...
0
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2812
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
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.