Ajax DataGrid Support Product Page

Answered

Date format

Asked 05 May 2010 04:27:59
4
have this question
05 May 2010 04:27:59 Doug Baltes posted:
I know this was discussed, but being a coder, what do I add to the format script to format a date column to mm/dd/yyyy? Just an example of the code would help. Thanks.

Replies

Replied 05 May 2010 10:24:15
05 May 2010 10:24:15 Miroslav Zografski replied:
Hello Doug,

Which is your server side language? ASP or PHP?

Regards,
Replied 05 May 2010 12:50:59
05 May 2010 12:50:59 Doug Baltes replied:
PHP
Replied 07 May 2010 01:40:24
07 May 2010 01:40:24 Doug Baltes replied:
I should have said in the first post that I am NOT a coder, but with some samples I can usually do some coding. I am working in PHP and just need a sample of setting a format up for a date format mm/dd/yyyy. Thank you.
Replied 29 May 2010 02:55:49
29 May 2010 02:55:49 Doug Baltes replied:
Any change I can get a sample of PHP format for dates in MYSQL format (yyyy-mm-dd). Thank you.
Replied 20 Mar 2012 22:26:03
20 Mar 2012 22:26:03 toby taylor replied:
Any change I can get a sample of PHP format for dates in MYSQL format (yyyy-mm-dd). Thank you.
Replied 21 Mar 2012 08:15:46
21 Mar 2012 08:15:46 Vulcho Vulev replied:
Hello Toby.

Which version of PHP you are using ?

Regards: Vulcho.
Replied 21 Mar 2012 13:55:42
21 Mar 2012 13:55:42 toby taylor replied:
PHP Version 5.1.6
Replied 22 Mar 2012 08:09:00
22 Mar 2012 08:09:00 Vulcho Vulev replied:
This example uses PHP, which has two extremely useful built-in functions for dealing with dates and times: strtotime() and date().
1	$res = mysql_query('SELECT datefield FROM tablename WHERE foo = "bar"');
2	$row = mysql_fetch_array($res);
3	print date('d M Y', strtotime($row['datefield']));

The strtotime() function is used to parse the date and time returned from the MySQL query into a UNIX timestamp. The date() function then formats that returned timestamp into 'd M Y' format, which is the day of the month with a leading zero, followed by the short month name (eg 'Jan', 'Feb', 'Mar') then a 4 digit year.
Replied 25 Oct 2012 12:42:41
25 Oct 2012 12:42:41 Pete Manning replied:
Hi Vulcho,

This sounds like what I need but how do I implement this to be used on a datagrid using a recordset?

Thanks

Pete
Replied 26 Oct 2012 07:37:04
26 Oct 2012 07:37:04 Pete Manning replied:
I solved this with a view using a "complex" SQL statement which formats the date

Reply to this topic