.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old January 24th, 2002, 11:22 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Converting timestamp

Originally posted by : Sakari (temppu@temppu.net)I have a simple problem, I want to convert a timestamp to vbGeneralDate format.The timestamp is in this format:Thu, 24 Jan 2002 09:56:27 +0200So it would be much easier to handle if it would be possible to convert to:01/24/2002 09:56:27 PMfor example.Can anyone help me, there must be some easy way to do that, it's a quite common task I think.Waiting for some quick help, my project is waiting.. -Sakari

Reply With Quote
  #2  
Old January 24th, 2002, 05:31 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Originally posted by : Sakari (temppu@temppu.net)Well, I kind of solved the problem by my self. I did a little function wich takes care of something.. but sill there is one thing that I don't understand..there was some timestamps like these:Thu, 24 Jan 2002 09:56:27 +2000 (GMT)Thu, 24 Jan 2002 09:56:27 +0200Thu, 24 Jan 2002 09:56:27 -0200 (EET)Thu, 24 Jan 2002 09:56:27 GMTThu, 24 Jan 2002 09:56:27 -0800Thu, 24 Jan 2002 09:56:2 +-020024 Ene 2002 09:56:27 +0200Thu, 24 Jan 2002 09:56:27 +0800 (Singapore Standard Time)And I managed to convert all but that +- one and the Ene one.. but I am quite sure those were some kind of errors in some part.. well my function just gives them a Now() time in replacement.If anyone is interested, here is my function. I know it is made with simple way. I am quite tired for today's work. So forgive me my programming skills for today. =)Function ConvertTimestamp (strDate) strDotchk = "not_ok" strTrim_1 = InStrRev(strDate,"(") If strTrim_1 0 Then strDate = Left(strDate, strTrim_1 - 1) End If strTrim_2 = InStr(strDate,",") If strTrim_2 0 Then strTrim_3 = Len(strDate) strDate = Right(strDate, strTrim_3 - strTrim_2) End If strDate = Trim(strDate) strTrim_4 = InStrRev(strDate,"+") If strTrim_4 0 Then strTrim_5 = Len(strDate) strTimeDif = Trim(Right(strDate,strTrim_5 - strTrim_4)) strDate = Trim(Left(strDate,strTrim_4 - 1)) strTimeDif_h = Left(strTimeDif,2) strTimeDif_n = Right(strTimeDif,2) If IsDate(strDate) = true Then strDate = DateAdd("N",strTimeDif_n,strDate) strDate = DateAdd("H",strTimeDif_h,strDate) strDotchk = "ok" End If End If strTrim_6 = InStrRev(strDate,"-") If strTrim_6 0 Then strTrim_7 = Len(strDate) strTimeDif = Trim(Right(strDate,strTrim_7 - strTrim_6)) strDate = Trim(Left(strDate,strTrim_6 - 1)) strTimeDif_h = Left(strTimeDif,2) strTimeDif_n = Right(strTimeDif,2) If IsDate(strDate) = true Then strDate = DateAdd("N",strTimeDif_n,strDate) strDate = DateAdd("H",strTimeDif_h,strDate) strDotchk = "ok" End If End If If strDotchk "ok" Then strTrim_8 = InStrRev(strDate,":") If strTrim_8 0 Then strDate = Trim(Left(strDate,strTrim_8 + 2)) End If End If If IsDate(strDate) = false Then strDate = FormatDateTime(Now(),vbGeneralDate) End If ConvertTimestamp = strDateEnd FunctionOK.. BED TIME!------------Sakari at 1/24/2002 9:22:52 AMI have a simple problem, I want to convert a timestamp to vbGeneralDate format.The timestamp is in this format:Thu, 24 Jan 2002 09:56:27 +0200So it would be much easier to handle if it would be possible to convert to:01/24/2002 09:56:27 PMfor example.Can anyone help me, there must be some easy way to do that, it's a quite common task I think.Waiting for some quick help, my project is waiting.. -Sakari

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Converting timestamp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway