.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

convert date to byte then hash using SHA1

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework

I have a string that has a date time and a string, I need to convert that string into a byte and then hash it using SHA1 hash format.

How can I convert a datetime to a byte. My date time format looks like this: 2010-12-01T22:52:05 and my string looks like this. server123_jimk1lidkdlsalsi

so my string that i need to SHA1 has looks like this



what is the best way to convert it to a byte a hash it?

View Complete Post

More Related Resource Links

Cannot convert type 'object[]' to 'byte[]'


I am doing this .. and i want to convert object array to byte array. How should I do that?

Object[] myVal = um.myData;

Byte[] byteArray = (Byte[])myVal;

How to convert Date format from dd/MM/yyyy to mm/dd/yyyy in asp.net



         I am using a text box which captures the date from the datepicker and displays in dd/MM/yyyy format in asp.net using C#

When i try to pass this text box value into the DatTime variable i am getting the error as

"String was not recognized as a valid DateTime. "


my code goes like this

DateTime dt;




i tried to use Conver.ToDateTime() function but the same error is croping up..


Can any one plz suggest me on this.....Thnks in advance

Convert Update Date/Time to VB.NET



I was wondering if someone could convert this into VB.NET for me.  I'm not a PHP pro and not entirely sure what's happening here nor do I know how to get this to display the same way.

The new field is within a DetailsView, so you can give me example code as well, I'll greatly appreciate it.

Thanks.. -Jeff

PHP Code:

function updFormat($tStamp) {
	$tsTime = (strftime('%I', $tStamp) + 0) . strftime(':%M %p', $tStamp);
	// 86400 == # of seconds in a day
	$tsDays = floor($tStamp / 86400);
	$nowDays = floor(time() / 86400);
	if ($tsDays == $nowDays) $updTime = "Today at $tsTime";
	elseif ($tsDays == $nowDays - 1) $updTime = "Yesterday at $tsTime";
	else $updTime = strftime('%b ', $tStamp) . (strftime('%d', $tStamp) + 0) . strftime(', %Y' , $tStamp);

	return $updTime;
<asp:DetailsView ID="dtv_LastUpdated" runat="server" Width="100%" 
    AutoGenerateRows="False" DataSourceID="ods_MVPParcelUpdate" 
    CellPadding="1" CellSpacing="1" GridLines="None">
        <asp:BoundField DataField="Update_time" HeaderText="Parcel Data:" 

how can i convert Persian date to c# date time?

hi all how can i convert Persian date to c# date time? Persian Date like 1388/01/20 Thanks Motevallizadeh

Convert a string (from xml) into date time

Is there a simple command to take this string: 2010-09-09T17:00:00.000Z and turn it into a date time? It is a date time value that is passed to us in an xml document, it has a type of 'unitless', when I read it I need to set a dateTime variable to this date and tim, I can parse it, but perhaps there is a simple single command that is already written for just such a thing. Thanks. 

Need to convert query string(date - 09/15/2010) to a text format - yyyymmdd

I am fairly new to C # and need some assistance with a form page.  I have created a simple form that requires the user to select a beginning date and ending date.  I then pass the values to my code behind page via query strings.  I have them passing, but I need the format to be change to a different format.  Unfortunately the database does not use the standard date format.  It requires the date to be in a text format as YYYYMMDD.Form: <tr> <td> Beginning Date:</td> <td><asp:TextBox runat="server" ID="begDate"></asp:TextBox> <asp:Image ID="Image2" ImageUrl="~/images/calendar_schedulehs.png" runat="server" /></td> </tr> Code Behind: protected void createReport_Click(object sender, EventArgs e) { StringBuilder url = new StringBuilder("Report/TopCustomer.aspx?"); url.Append("BegDate=" + begDate.Text); url.Append("&EndDate=" + endDate.Text); url.Append("&Brnch=" + ddlLocation.SelectedValue); Response.Redirect(url.ToString()); Current URL: TopCustomer.aspx?BegDate=09/15/2010&EndDate=09/30/2010&Brnch=300I need to have the above URL change to:TopCustomer.aspx?BegDate=20100915&E

convert date to mmddyy format before submit to database

Dear all,   Could anyone pls guide me on how to convert date in textbox which is in format(dd/mm/yy) to mmddyy before submit to database.    

Convert Remedy ARSystem Date in SQL Server to short date format

Hi: Does anyone know how to convert Remedy ARSystem Date in SQL Server to short date format compensating for EST and Daylight savings. Thank you in advance!

How to Date function convert (09/13/2010 10:18:24 to 13.Sep.10)

 How to Date function convert (09/13/2010 10:18:24  to     13.Sep.10)passing a simple query no template used input  09/13/2010 10:18:24output 13.Sep.10

how to jquery date convert to Timestamp


how to jquery date convert to  Timestamp

convert string into date of birth



was just wondering what is the best way of creating date of birth string from the a text like "980123-09-5623", I only need the first 6 digits..to be convereted to date of birth, for example -- 98 represents the year..1998, 09 represents September and 23 represents the date.

hmm..it looks so complicated..can it be done using calculated services..can I do something like this..get the string and store it in a date field in a form like..23-01-98(separated by -)...then..i can get another calculated field with a date format such as...23 January 1998



Passing Date Paramaters (Convert(Char(10, ,DATE,110))


I need to pass in user friendly date paramaters for values but I'm not sure how to display the converted dates in the stored porcedure that I'm passing frienldy dates to  do i need to do a converert everywhere that i have a date field?

and where around the dateadd columns?


@MINDT datetime
					,@MAXDT datetime
					,@EM_ITEM_NUM CHAR(7)
WITH itmlvl AS (




	, rb.DSCR
	, rp.AMT
	, rp.EFF_DT
	, splr.EM_ITEM_NUM

FROM geprs_dnc..T_REBATE rb 
		JOIN geprs_dnc..T_REBATE_PERIOD rp 

How to Convert System.Drawing.Image Variable to Byte variable



I got a variable of type System.Drawing.Image and need to convert it to a variable of type byte so I can store the image in the database. Can someone show me how to do that in VB.NET code.

Thanks alot

how to convert a byte[] to a xsd:hexBinary in the WSDL generated of a WCF service


Hi, i always see a byte[] type in the contract gets converted into a base64Binary type. What should i do in my WCF service contract so that the date type in the WSDL comes out to hexBinary ?

Will appreciate your help.


Convert date in dd.mm.yyyy


Date on the page is displayed in the format mm.dd.yyyy, how to convert it to be displayed in the format  dd.mm.yyyy.

This is the code from the site:


whether it be something like this  <%# Convert. ??????  Eval("newsDate")%> 


add column to gridview to convert date


can I add a column to gridview that will convert the utc date to my local time?  HOw? 

Convert Date (dd-MM-YYYY) to (dd/MM/YYYY)


Dear Sir,

In my DB, there is 5000 date values are stored like "DD-MM-YYYY" Format in nvarchar datatype. For Example 18-10-2010

And when i convert into date format for the following purpose.

"Select * from tbl_master order by Convert(datetime,date_of_Appln,103)"

Its not working.

Can you help me to convert? or Can you help me to replace the "-" symbol to "/"?

Thanks in advance.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend