Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


LinkBack Search this Thread
Old 12-10-2001, 08:14 AM   #1
Citizen Bleys
Registered: Mar 2001
Location: Moncton, NB
Distribution: Gentoo 2006.0
Posts: 181

Rep: Reputation: 30
calendar-related code snippet request

Does anybody have a function (preferably written in C/++, Perl, or PHP) that takes a date (in month, year, and date format, with the M,D,Y parameters in any order) and returns what day of the week it was? I don't know the rules for adjustments and leap years and whatnot, so I can't really code this bit myself.
Old 12-10-2001, 09:38 AM   #2
Registered: Jul 2001
Location: London
Distribution: RH 9
Posts: 151

Rep: Reputation: 30
In php, getdate(timestamp) will return an associative array of info about the date.
$result["weekday"] would then give you the day of the week it was. You could use mktime() to get the timestamp from the D, M, Y format you needed to use


Old 12-11-2001, 12:11 PM   #3
Citizen Bleys
Registered: Mar 2001
Location: Moncton, NB
Distribution: Gentoo 2006.0
Posts: 181

Original Poster
Rep: Reputation: 30
Thanks. I feel like a complete dolt for not looking up the date() function in PHP, especially since that's the language I prefer to work with, even over C++ and Perl.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code: Bad EIP Value <1> unable to handle kernel paging request at virtual address Sabeer Linux - Software 6 02-13-2008 08:55 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
What's this calendar? max74 Linux - Newbie 7 09-22-2003 01:57 PM
prompt based calendar program? Calendar? thebeaglebeagle Linux - Software 0 09-15-2003 01:10 PM
How do I compile a code snippet. to test my box?? _Mhz Linux - Newbie 4 07-10-2002 11:03 AM

All times are GMT -5. The time now is 12:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration