This is a discussion on "DateTime Function" within the Classic ASP section. This forum, and the thread "DateTime Function are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
DateTime Function
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
In my database I have field named dateTime and in the web page i want to display the date in one column and the time in another. E.g.
dateTime = 01/01/2001 01.30.00 In the table i want to see date - 01/01/2001 time - 01.30.00 How do i do this i have spent hours searching the internet and this is my last resort. The people this site is for want to keep the database field as it is shown above. So the easy answer is gone! Any comments will be appreciated Tanya |
|
|
|
|||
|
If I have understood your questions right, I think you could just simply use the following DateTime-functions:
Year, Month, Day, Hour, Minute and Second. With these functions you can extract the relevant part of your DateTime data and easily reconstructed it in the way you want. For example: Date = Day(DateTime) & Month(DateTime) & Year(DateTime) Time = Hour(DateTime) & Minute(DateTime) & Second(DateTime) You may also want to check if the values resulting from the functions Day, Month, Hour, Minute and Second are less than 10 so that to prefix a Zero. In this way you ensure that dates and times are presented in the correct format (dd/mm/yyy and hh:mm:ss). For example 01/01/2006 and not 1/1/2006. I hope this helps you. Sincerely Jacque |
|
|||
|
Re: DateTime Function
Quote:
I'm facing a problem to change my date format from eg : 1/July/2006 to 01/July/2006. Tried to change setting the control panel but the result still the same. Hope you can help. |
|
|||
|
Re: DateTime Function
hello to all
|
|
|||
|
|
|
|||
|
Re: DateTime Function
Quote:
You can perform 2 function to get it. One for date, and one for time. you also have to create 2 field in your database to store the date and time. I have with me an example of date function in asp that might help you, This will display dd/mm/yyyy (eg: 01/12/2007)
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Last edited by Monie; Oct 26th, 2007 at 04:12. Reason: change [CODE] to [HTML] to show some coloring code.. |
![]() |
| Tags |
| datetime, function |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| convert string to datetime format ... | jeffmarsh | Other Programming Languages | 0 | Jul 2nd, 2006 06:36 |
| Getting value from function | melvinoyh | JavaScript Forum | 2 | May 27th, 2006 00:57 |
| Macros/function | letuan | Databases | 0 | Aug 15th, 2005 12:04 |
| SQL Function | spinal007 | Databases | 1 | Mar 25th, 2005 09:43 |
| Needing function help | stealthy1 | JavaScript Forum | 19 | Jul 6th, 2004 15:13 |