Tag Archives: formatting

An icon depicting a calendar and clock

How to format SQL Server datetime as dd/mm/yyyy hh:mm:ss

If you are exporting the results of a SQL Server query to excel typically the recipient of the file wants the dates referenced in the format “dd/mm/yyyy hh:mm:ss” or “dd/mm/yyyy” not in the usual database format yyyy-mm-dd.

The below query formats the datetime as desired. Note that the letter m representing month is capitalised. If they are not the engine will interpret the lowercase letter m as minute so you will end up with days, minutes, years.

Also not that the letter h representing the hours is also capitalised. Capitalising the h makes the time output with the 24 hour format. Lowercase h will be 12 hour format. It is highly recommended not to use the lowercase h.

SELECT FORMAT(GETDATE(), 'dd/MM/yyyy HH:mm:ss', 'en-us')

If you only want the date and not time just remove the relevant text, i.e. just date dd/MM/yyyy or datetime without second dd/MM/yyyy HH:mm.

How to fix winhiip writing to hard drive problem

If you are trying to format a hard drive to be used by a PlayStation 2 you’ve probably already come across excellent content like the video below and the necessary tools to do the job.

 

However you might, like me, run into the problem of winhiip not being able to right to the drive which will prevent it from formatting the drive correctly.

To resolve this problem you will need to manipulate the drive in Windows “Disk Management”.

Open Disk Management (to open type disk management in Windows search and hit enter)

Find the reference to disk you want to fix and if it has not already been formatted follow these steps:

  • Initialize the disk. (If not already initialized)
  • Right click the Unallocated Space on the disk and click New Simple Volume.
  • Proceed through the New Volume Wizard, setting the Volume size to the maximum disk space and formatting the drive under the NTFS file system. (Only a quick format is needed)
  • Wait for the drive to finish formatting, then right click the healthy partition you just made and click Delete Volume.
  • Open WinHIIP and click Select Drive, then select your drive. Press OK to all errors that pop up upon loading the drive.

At this point you should be able to write to the drive with no problems.