format

Convert a string to decimal in VB.NET

被刻印的时光 ゝ 提交于 2021-02-04 17:16:27
问题 What will be the easiest way to convert a string to decimal? Input: a = 40000.00- Output will be 40,000.00- I tried to use this code: Dim a as string a = "4000.00-" a = Format$(a, "#,###.##") console.writeline (a) 回答1: Use Decimal.Parse to convert to decimal number, and then use .ToString("format here") to convert back to a string. Dim aAsDecimal as Decimal = Decimal.Parse(a).ToString("format here") Last resort approach (not recommended): string s = (aAsDecimal <0) ? Math.Abs(aAsDecimal)

SimpleDateFormat. format returning wrong date

怎甘沉沦 提交于 2021-02-04 08:40:32
问题 I have this code I would like to know why it returns correct date Festival f= (Festival) festival.get(0); Date d=f.getSDate(); System.out.println(d.getYear()); System.out.println(d.getMonth()); System.out.println(d.getDate()); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); // define your format. String formattedDate = df.format(d); System.out.println("New Date To Show::"+formattedDate); the output is this 2019 2 27 New Date To Show::27/03/3919 回答1: Try to use this : Date date=new

Date Time format displays differently in ISE and Windows Forms

风格不统一 提交于 2021-02-02 09:05:44
问题 When I run Get-Date in ISE, I get Wednesday, 15 April 2020 12:38:03 PM which I want. However, if I run the same command in Windows Forms, I get 04/15/2020 12:38:03 in a different format. I run them from the same computer so it must be the same cultural/region. 回答1: 1. Customizing your date using -Format or -UFormat You can use the -Format or the -UFormat paramater to enforce a certain layout of your date: Get-Date -Format "dddd, d MMMM yyyy hh:mm:ss tt" Get-Date -UFormat "%A, %e %B %Y %r"

Linux: fast creating of formatted output file (csv) from find command

不羁岁月 提交于 2021-01-29 21:39:19
问题 I have several devices, which I want to collect in a list (csv) to put them into a mysql database. I began with a device with the goal to create a new formatted output file, from infile file which was created with 'find'. The device is /mnt/sda4 and I have skipped all entries containing '.cache'. I also have already cut /mnt/sda4/ : find /mnt/sda4 | grep -v '.cache' | cut -d'/' -f4- > infile where the infile is like that: Extern-500GB-btrfs/root/usr/lib64/libreoffice/share/config/soffice.cfg

How do I attach a working pdf of my google sheet to a draft email?

对着背影说爱祢 提交于 2021-01-29 20:40:38
问题 I have a script that was put together to open, rename, and export a google sheet as a pdf. Then that sheet would be added to an email draft. I have been using this script for two years without issue, but for some reason, the pdf attachment will no longer open. The error message I get is "Adobe Acrobat Reader could not open [File Name.pdf] because it is either not a supported file type or because the file has been damaged." I go directly to the google sheet and export as a pdf manually, I can

Indicating format of multiple numbers in numpy.savetxt

被刻印的时光 ゝ 提交于 2021-01-29 18:03:01
问题 I want to save an array using numpy.savetxt . The array contains eight numbers. Only the format of the first number is different with respect to the latter seven. I know I can set the format of numbers as follows: numpy.savetxt(filename, array, fmt = "%03d" "%.10f" "%.10f" "%.10f" "%.10f" "%.10f" "%.10f" "%.10f") Here filename is just the name of my file e.g. numbers.dat and array is a 1D numpy array containing my eight numbers. The above line of code works but looks ridiculous because I'm

Formating programmatically Excel cells from Scientific numeric to Text with C#

北城余情 提交于 2021-01-29 12:20:50
问题 I'm facing a problem after extracting data from my sqlServer dataBase to my Excel worksheet using Microsoft.Office.Interop.Excel reference. Numeric data are displayed in a scientific numeric format, instead of being displayed in a text format. I tried to format my cell this way, but still doesn't work : Microsoft.Office.Interop.Excel.Range cell= (Range) worksheet.Cells[rowNum, fieldNum]; cell.NumberFormat="@"; I tried even to set my cells format in my Input Excel file; which i'm actually

Parse string date (EEST included) but it fails

泪湿孤枕 提交于 2021-01-29 08:31:14
问题 I am trying to parse a string into a DateTime , but it fails and shows an exception. The code is provided below: static void Main(string[] args) { string dt = "Wed Sep 05 00:00:00 EEST 2012"; string Fm = "EEE MMM dd HH:mm:ss zzz yyyy"; DateTime dateTime; dateTime = DateTime.ParseExact(dt, Fm, CultureInfo.InvariantCulture); Console.WriteLine(dateTime.Date); } This is the exception: Unhandled Exception: System.FormatException: String was not recognized as a valid DateTime. at System.DateTime

Convert string of format “19-07-2018 08:10:24” in date and time both different string format

梦想的初衷 提交于 2021-01-29 06:13:21
问题 I want to Convert string of format "19-07-2018 08:10:24" in date time format. If the date is today then it should be "02:12 am". If the date is of yesterday then it should be like "Yesterday". Otherwise it should be in "DD/MM/yy" format. Currently I am having the time and date in string formate. I want the final answer in string type. If the answer is "DD/MM/YY", then it should be in string format. 回答1: Use the Calendar date functions: func format(date: Date) -> String { let calendar =

Format numbers in TextBox as you type

半城伤御伤魂 提交于 2021-01-29 01:41:46
问题 Is there is any way to format numbers in TextBox (on a UserForm) as you type? This way it makes easy to see what figure is being entered. My desired format is: #,##0.00 回答1: This could be considered a slightly " Above the Average " question in terms of difficulty for a newbie so I am going to answer this :) VBA doesn't have what you call a Masked Text Box where you can set formats as #,##0.00 . You can only do a masked textbox for accepting passwords but that is altogether a different thing.