Connecting Tech Pros Worldwide Help | Site Map

Date formatting to iCal Standard.

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 5th, 2008, 11:55 PM
Jerry Yang
Guest
 
Posts: n/a
Default Date formatting to iCal Standard.

Hi
My DB has 2 fields, one which has the date the other has the time.

The date field is called Appt_Date and has values like 12/03/2008 (DD/
MM/YYYY)

The time field is called Appt_Time and has values like 10:30 (am)

I can retrieve both of these fields from the DB and present them on
screen, but I need to do it in iCAL format.

For example, the following represents Janurary 18, 1998, at 11 PM:

19980118T230000

Any idea how I can do this ?

Thanks

  #2  
Old September 6th, 2008, 11:55 PM
=?Utf-8?B?T2xkIFBlZGFudA==?=
Guest
 
Posts: n/a
Default RE: Date formatting to iCal Standard.



"Jerry Yang" wrote:
Quote:
My DB has 2 fields, one which has the date the other has the time.
The date field is called Appt_Date and has values like 12/03/2008 (DD/
MM/YYYY)
No, it doesn't. That might be how they show up when you display them, but I
guarantee you that whatever DB you are using, they are stored in some
unreadable-by-humans internal form. (Well...maybe excepting for MySQL.
Where they will be stored as YYYYMMDD.)
Quote:
The time field is called Appt_Time and has values like 10:30 (am)
Ditto.
Quote:
For example, the following represents Janurary 18, 1998, at 11 PM:
19980118T230000
Any idea how I can do this ?
Easy, peasy:

<%
....
dt = RS("Appt_Date")
tm = RS("Appt_Time")
iCalTime = (Year(dt) * 10000 + Month(dt) * 100 + Day(dt) ) _
& "T"
& (Hour(tm)*10000 + Minute(tm) * 100 + Second(tm))
....
%>

Okay?
  #3  
Old September 7th, 2008, 12:05 AM
=?Utf-8?B?T2xkIFBlZGFudA==?=
Guest
 
Posts: n/a
Default RE: Date formatting to iCal Standard.

"Old Pedant" wrote:
Quote:
<%
...
dt = RS("Appt_Date")
tm = RS("Appt_Time")
iCalTime = (Year(dt) * 10000 + Month(dt) * 100 + Day(dt) ) _
& "T"
& (Hour(tm)*10000 + Minute(tm) * 100 + Second(tm))
...
%>
Oops...missed the underline on the "T" line.
It should read:
& "T" _

Or you can jam all of that stuff onto a single line of code and get rid of
the underlines. I formatted it like that so it would show cleanly in most
newsreaders. And then blew it. <sigh/>

  #4  
Old September 7th, 2008, 04:25 PM
Jerry Yang
Guest
 
Posts: n/a
Default Re: Date formatting to iCal Standard.

Thanks :) very much appreciated..
 

Bookmarks

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 On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.