|
|
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » [FEATURE REQUEST] Time to UTC ISO 8601 and UTC ISO 8601 to Time
[FEATURE REQUEST] Time to UTC ISO 8601 and UTC ISO 8601 to Time [message #14041] |
Thu, 07 February 2008 15:39 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
UTC time formatted by ISO 8601 standard is very common now and is the default DateTime format for all XML documents. It would be great to have simple functions that can turn a Time object into a UTC ISO 8601 formatted String and also to create a Time object from a UTC ISO 8601 String.
Creating a UTC String is as simple as:
String utc = FormatTime(t, "YYYY-DD-MMThh:mm:ss");
But converting a UTC String to Time is a bit more difficult. I have tried to use the StrToDate(time_object, utc_string) function, and it does parse the date correctly, but I can only receive a Date object from this, not the time details as well.
StrToTime would be great, especially with UTC ISO 8601 support.
Thanks.
|
|
|
|
|
|
|
|
|
Re: [FEATURE REQUEST] Time to UTC ISO 8601 and UTC ISO 8601 to Time [message #18475 is a reply to message #18404] |
Thu, 02 October 2008 21:32 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
Simple function I used in my program:
Time UTCStrToTime(String utc_str){
//utc example: 2006-01-04T21:59:11
int year = StrInt(utc_str.Left(4));
int month = StrInt(utc_str.Mid(5,2));
int day = StrInt(utc_str.Mid(8,2));
int hour = StrInt(utc_str.Mid(11,2));
int minute = StrInt(utc_str.Mid(14,2));
int second = StrInt(utc_str.Mid(17,2));
return Time(year, month, day, hour, minute, second);
}
|
|
|
|
|
Goto Forum:
Current Time: Sun Jun 16 00:41:07 CEST 2024
Total time taken to generate the page: 0.02346 seconds
|
|
|