Rank: Advanced Member
Groups: Member
Joined: 9/22/2008(UTC) Posts: 39
|
I'm able to pull the ExifDateTime attribute from the JPG file, but I have to insert it into a SQL 2000 database that has a datatype of "date". How do I convert "2006:05:11 14:40:00" To just "05/11/2006" as a date? I have this in my upload script: Code:Dim theDateTaken As String = Request.Form("ExifDateTaken_" & i)
But doing: Code:cmdInsert.Parameters.Add("@DateTaken_" & i & "", Format(theDateTaken, "MM/dd/yyyy"))
doesn't work. Any idea? I'm still a n00b at VB and ASP.NET Thanks Edited by user Tuesday, October 14, 2008 5:40:46 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hello, Please try to use this code: Code:Dim info AS New DateTimeFormatInfo()
info.ShortDatePattern = "yyyy:MM:dd HH:mm:ss"
Dim theDateTaken As DateTime = DateTime.ParseExact(Request.Form
["ExifDateTaken_" + Parent.FileIndex], "d", info)
cmdInsert.Parameters.Add("@DateTaken_" & i & "", theDateTaken)
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/22/2008(UTC) Posts: 39
|
Doesn't seem to work in VB, is that right? I get: BC30002: Type 'DateTimeFormatInfo' is not defined.
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Quote:Doesn't seem to work in VB, is that right? I get: BC30002: Type 'DateTimeFormatInfo' is not defined. DateTimeFormatInfo is defined System.Globalization namespace. So either import this namespace or specify full class name: Code:Dim info AS New System.Globalization.DateTimeFormatInfo()
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/22/2008(UTC) Posts: 39
|
This just doesn't seem to work still. I get something saying paramter "s" is not defined: Dim info AS New System.Globalization.DateTimeFormatInfo() info.ShortDatePattern = "yyyy:MM:dd HH:mm:ss" Dim theDateTaken As DateTime = DateTime.ParseExact(Request.Form("ExifDateTaken_" & i), "d", info)
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, Please, try this sample: Code:
Dim exifDateTime As String = "2006:05:11 14:40:00"
Dim exifDateTimeFormat As String = "yyyy:MM:dd HH:mm:ss"
Dim dateTime As System.DateTime = System.DateTime.ParseExact(exifDateTime, _
exifDateTimeFormat, System.Globalization.CultureInfo.InvariantCulture)
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.