473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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

59
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 2817
Atli
5,058 Expert 4TB
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
figured out a way around it, problem solved. Thanks for your help :)
Oct 19 '07 #3
ronverdonk
4,258 Expert 4TB
Want to share your solution with our members?

Ronald
Oct 19 '07 #4
cssExp
59
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 Expert 4TB
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
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...
4
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...
13
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...
20
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...
6
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...
2
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...
6
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...
5
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...
11
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;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.