473,320 Members | 1,993 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,320 software developers and data experts.

how to print 1965-05-09

hi there,

can anyone there teach me how to solve this?

my table - date field value return 1965-06-20, i want to display this
value in d-m-Y format.

how to print? now i only get it print as 01/01/1970 if the year<1970.

i know there is an adodb_date function. but then how can i convert
this value to time format as i also cannot use the strtotime function?
strtotime also return as -1. which also error.

help..

thank you

Jul 17 '05 #1
3 1303
.oO(shamei)
can anyone there teach me how to solve this?

my table - date field value return 1965-06-20, i want to display this
value in d-m-Y format.
Why not let the database return the date in the format you like?
how to print? now i only get it print as 01/01/1970 if the year<1970.


That's the starting point of Unix timestamps. Some systems also allow
negative timestamps for dates <1970, but not all.

Micha
Jul 17 '05 #2
"shamei" <se****@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
hi there,

can anyone there teach me how to solve this?

my table - date field value return 1965-06-20, i want to display this
value in d-m-Y format.

how to print? now i only get it print as 01/01/1970 if the year<1970.

i know there is an adodb_date function. but then how can i convert
this value to time format as i also cannot use the strtotime function?
strtotime also return as -1. which also error.

help..

thank you


There's good old sscanf() you can use:

sscanf($date, "%4d-%2d-%d", &$year, &$mon, &$day);

echo "$day/$mon/$year";
Jul 17 '05 #3
In article <11*********************@c13g2000cwb.googlegroups. com>,
se****@gmail.com says...
hi there,

can anyone there teach me how to solve this?

my table - date field value return 1965-06-20, i want to display this
value in d-m-Y format.

how to print? now i only get it print as 01/01/1970 if the year<1970.

i know there is an adodb_date function. but then how can i convert
this value to time format as i also cannot use the strtotime function?
strtotime also return as -1. which also error.

help..

thank you


SQL has the solution.
Syntax may differ depending on the backend Database (Access over ODBC?)
but what you want is something like:

SELECT DATE_FORMAT('dd-mm-YYYY', DateField) AS 'Date' FROM items;

Lookup the DATE_FORMAT for exact values available in the format field.

Note of advice:
Avoid confusing dates such as 02-01-01
Jan 1st? Feb 2nd? 2001? or 2002? ... 1902?

Particularly when producting any sort of information accessed by the
public, or many people, or used for historic references.

If you can, leave it in international format or use '01 Jan 2005', etc.

--
AJ
Treehouse Networks abuse@
www.treenetnz.com
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
29
by: JS | last post by:
I would like to print char 'd': main(){ char g; g = 'a'; g = 'b'; g = 'c'; g = 'd';
0
by: bearophileHUGS | last post by:
There is/was a long discussion about the replacement for print in Python 3.0 (I don't know if this discussion is finished): http://mail.python.org/pipermail/python-dev/2005-September/055968.html ...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
3
by: James J. Besemer | last post by:
I would like to champion a proposed enhancement to Python. I describe the basic idea below, in order to gage community interest. Right now, it's only an idea, and I'm sure there's room for...
69
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
7
by: samslists | last post by:
Am I the only one that thinks this would be useful? :) I'd really like to be able to use python 3.0's print statement in 2.x. Is this at least being considered as an option for 2.6? It seems...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.